You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the path to the logback.xml file is defined in the JAVA_TOOL_OPTIONS environment variable (like e.g.: JAVA_TOOL_OPTIONS=-Dlogback.configurationFile=/path/to/logback-external.xml) this configuration should be used
Actual Behaviour
The external logback XML file is used as expected until the end of the bean registration phase. From that point, the framework switches back to the default logback.xml file placed under the resources folder.
define e.g. logback-external.xml file either in the resources folder or anywhere else. Make sure that it logs somehow differently than the default logback.xml.
run the application with JAVA_TOOL_OPTIONS=-Dlogback.configurationFile=/path/to/logback-external.xml environment variable
configuration defined in logback-external.xml is ignored once the application started up
Environment Information
Micronaut version: 3.8.0 - everything works fine below that
Operating system: MacOS
JVM: Temurin-17.0.5+8
Example Application
No response
Version
3.8.0
The text was updated successfully, but these errors were encountered:
This is also a real issue for us because we use this feature to inject logback configuration in a kubernetes environment and with an update to 3.8.x the services won't start up anymore complaining about logback.xml is mssing.
I checked out the LogbackUtils code which loads the config into Logback, and I really cannot understand why this is limited to the Classpath. The resource is mapped to a URL anyway in that class, so why not use just a little cleverer approach to look up the resource? @driverpt@graemerocher This should really be looked into, as it really is a huge regression when upgrading Micronaut.
Expected Behavior
When the path to the
logback.xml
file is defined in theJAVA_TOOL_OPTIONS
environment variable (like e.g.:JAVA_TOOL_OPTIONS=-Dlogback.configurationFile=/path/to/logback-external.xml
) this configuration should be usedActual Behaviour
The external logback XML file is used as expected until the end of the bean registration phase. From that point, the framework switches back to the default
logback.xml
file placed under the resources folder.This behaviour was introduced in PR #8238, it's caused by this method: https://github.com/micronaut-projects/micronaut-core/blob/3.8.x/management/src/main/java/io/micronaut/management/endpoint/loggers/impl/LogbackLoggingSystem.java#L135-L149
Steps To Reproduce
logback-external.xml
file either in the resources folder or anywhere else. Make sure that it logs somehow differently than the defaultlogback.xml
.JAVA_TOOL_OPTIONS=-Dlogback.configurationFile=/path/to/logback-external.xml
environment variablelogback-external.xml
is ignored once the application started upEnvironment Information
Example Application
No response
Version
3.8.0
The text was updated successfully, but these errors were encountered: