I am just starting to use logback and I have a question:
Should you create one logger for each class like the following:
final static Logger logger = LoggerFactory.getLogger(className.class);
Or is that too much? maybe create a logger one per package? what is the generally considered good practice? thanks.
One (private one) per class - the overhead is low and you get the source information (which logger printed this) for free.
Occasionally it's worth creating an additional logger for an inner class if you want to setup your log configuration to report them at different levels.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With