Created
June 19, 2019 21:08
-
-
Save bjpeterdelacruz/d6f3c18a067dafe1826ffeee480cc458 to your computer and use it in GitHub Desktop.
How to log a method in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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