Skip to content

Instantly share code, notes, and snippets.

Embed
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 = Instant.now();
try {
// do something
} finally {
Instant end = Instant.now();
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.