Reputation: 2471
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.
Upvotes: 7
Views: 461
Reputation: 76
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.
Upvotes: 2