[logback-user] What's best practices to maintain logger names in backend configuration files like logback.xml?
Thorsten Schöning
tschoening at am-soft.de
Fri Apr 3 10:22:42 CEST 2020
Hi all,
I'm using Logback mostly, but things are the same for other logging
backends in the end. My current approach is to maintain `logback.xml`
per deployment of some software project, which might be some daemon,
web app or whatever. If it has an individual deployment and is known
to use logging at all, it gets an individual config file.
But should that file contain all logger names known and used by some
application?
I did so in the past to clearly document which loggers are available
at all. Many of those are related to concrete classes and don't need
to be configured individually in theory, but the most likely available
root logger is enough already. OTOH, there are use cases for very
specific loggers which additionally exist per class. Sometimes e.g. I
have very special status loggers with very custom logging format which
need to write some data to some special fail or send some mail or
else. Because those are so special and need to be configured
specially, they need to be part of the config file always.
The downside of adding all loggers to those files clearly is
maintenance overhead: The same logger might be available in multiple
files, so renames need to be applied everywhere. Newly added loggers
need to be added to all files, but one can't easily know if some class
of some package is used in some app only only because some
package/project is used in that app.
The benefit of this approach clearly is that at best every admin
always simply knows which loggers are available by looking into the
config and can configure log levels for individual loggers of interest
only. Otherwise one would need to start logging and blacklist things
clearly not of interest.
Does anyone else do this or is it not worth the effort?
Thanks!
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: Thorsten.Schoening at AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
More information about the logback-user
mailing list