Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
None
-
1.0.6
-
None
-
Eclipse (Juno), Java 7, Logback v1.06
Description
A feature request ...
Ability to aggregate logger XML elements defined in separate logback.xml files.
- Perhaps a logback.xml could import the definitions of other logback.xml files (with arbitrary names such as "logback-mylibrary.xml) ... in a manner similar to XML schema importing ... or a namespace context.
Context:
- I have a java library of common utilities and services which defines its own logback.xml configuration file.
- As issues arise, i can switch the message level (WARN->DEBUG) as needed to track down issues.
- It is more intuitive to change these settings in the library project's logback.xml (rather than going "up" to the application project to change the settings)
However, presently the "application layer" logback.xml is the only logback.xml configuration loaded ... so to turn on debug level messages in the library the application needs to define those in the application's logback.xml.
The idea would be that when "MyApp" loads its logback.xml ... it could also load, and "aggregate", the loggers (appenders, etc.) defined in the "MyLibrary" logback.xml. For instance, MyApp.jar (logback-MyApp.xml) could include logback configuration settings from MyLibrary.jar's logback-MyLibrary.xml
This way the "application layer" does not need to know about the library's inner workings. And the logger settings remain local to the relevant source code. In other words, the <i>application</i> would not configure the <i>library's</i> loggers.
Might need the ability to have the top level "override" the child settings (example: disable messages from a third party package regardless of its configuration settings)
(I'm also using third party jars which have logback.xml defined. But it hasn't been a problem since its logback.xml lower in the link order / classpath)
Maybe this can be handled with a custom JoranConfigurator ...?