SLF4j - log question: how many logger objects should you create?

I am just starting to use logback, and I have a question:

If you create one registrar for each class, for example:

final static Logger logger = LoggerFactory.getLogger(className.class); 

Or is it too much? perhaps create a registrar one per package? What is common practice? thanks.

+6
source share
1 answer

One (closed) for each class - the overhead is low, and you get the initial information (which was published in this journal).

Sometimes it’s worth creating an additional logger for the inner class if you want to customize your log configuration to report them at different levels.

+2
source

Source: https://habr.com/ru/post/888237/


All Articles