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
we just realized that logback behaves differently when handling the inclusion of files that use properties.
This different behavior was introduced with version 1.3.0 and its changes to the configuration implementation.
I'm not sure whether this is actually a bug. Perhaps we relied on something that was never intended to work.
Our usecase
We want to include a configuration snippet multiple times and use properties to slightly change the snippet every time.
A very simple example is an appender definition with a name derived from a property:
This works fine with version 1.2.12.
Here's the status log:
09:45:03,179 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@566776ad - Adding [file://snippet.xml] to configuration watch list.
09:45:03,180 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:45:03,182 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [A]
09:45:03,203 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@566776ad - Adding [file://snippet.xml] to configuration watch list.
09:45:03,205 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:45:03,205 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [B]
Version 1.3.x
This doesn't work anymore since version 1.3.0. It doesn't work with 1.4.11 neither.
The properties value is always B (as seen by the included snippets).
10:12:35,409 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@7b49cea0 - Adding [file:///snippet.xml] to configuration watch list.
10:12:35,413 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@7b49cea0 - Adding [file:///snippet.xml] to configuration watch list.
10:12:35,458 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [B]
10:12:35,458 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
10:12:35,476 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [B]
10:12:35,477 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
In our real world use case the application does not start anymore, since logback detects the same file name pattern to be used multiple times.
Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting.
The file name pattern is defined by a property. The file appenders are included with a snippet.
Related issues
There is an open feature request to support passing of parameters to included snippets in a different way: https://jira.qos.ch/browse/LOGBACK-1104
If this is not considered a bug, I vote for this feature request.
https://jira.qos.ch/browse/LOGBACK-1760 might be related, even though the variable is used in the <include> tag not in the included snippet.
Since this ticket states 1.4.12 as fix version, I tried our use case with the 1.4.12-SNAPSHOT but it doesn't work.
Thank you for your support!
The text was updated successfully, but these errors were encountered:
Hello everyone,
we just realized that logback behaves differently when handling the inclusion of files that use properties.
This different behavior was introduced with version 1.3.0 and its changes to the configuration implementation.
I'm not sure whether this is actually a bug. Perhaps we relied on something that was never intended to work.
Our usecase
We want to include a configuration snippet multiple times and use properties to slightly change the snippet every time.
A very simple example is an appender definition with a name derived from a property:
Now we want to include this snippet to create appenders with different names:
Thus, we want to pass parameters to the snippet.
Version 1.2.x
This works fine with version 1.2.12.
Here's the status log:
Version 1.3.x
This doesn't work anymore since version 1.3.0. It doesn't work with 1.4.11 neither.
The properties value is always B (as seen by the included snippets).
In our real world use case the application does not start anymore, since logback detects the same file name pattern to be used multiple times.
The file name pattern is defined by a property. The file appenders are included with a snippet.
Related issues
There is an open feature request to support passing of parameters to included snippets in a different way: https://jira.qos.ch/browse/LOGBACK-1104
If this is not considered a bug, I vote for this feature request.
https://jira.qos.ch/browse/LOGBACK-1760 might be related, even though the variable is used in the
<include>
tag not in the included snippet.Since this ticket states 1.4.12 as fix version, I tried our use case with the 1.4.12-SNAPSHOT but it doesn't work.
Thank you for your support!
The text was updated successfully, but these errors were encountered: