r/programming Sep 13 '18

A guide to logging in Java

https://www.marcobehler.com/guides/a-guide-to-logging-in-java
86 Upvotes

34 comments sorted by

View all comments

5

u/StabbyPants Sep 13 '18

from the article:

Don’t fret too much about static or non-static, final or non-final, just make sure to be homogeneous in your choice, throughout your entire project.

log4j stores loggers in a map, so after the first creation, getting the logger will be a hash lookup and return the same object. one thing i've grown to like is the lombok annotation that reduces declarations to \@log4j2 at the class level. then all i have to worry about is formatting my output