Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to log a method in Java
public void doSomething(String recordId) {
log.debug("Deficiency list for recordId: {} - START", recordId);
Instant start =;
try {
// do something
} finally {
Instant end =;
Duration duration = Duration.between(start, end);
log.debug("Deficiency list for recordId: {} - END, millis: {}", recordId, duration.toMillis());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.