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
Hello, we are facing the same issue mentioned in https://jira.qos.ch/browse/LOGBACK-1731 and we hoped, it will be fixed in 1.4.12 (as it is listed in fix-versions)
It seems that there was a change in when we migrated from 1.2 to 1.4
Using scope="system" seems to work in spring.
It seems that there is some logical order problem
As far as I could debug the issue, logback builds a "Model" which represents the complete config (with all included files)
and then, the properties are evolved. So due this order problem, it is not possible to use parameters in include tags. (Note: I'm not very familiar with the architecture in logback, so this is just a guess, what I've ssen in debugger)
When you apply scope="system" - logback puts the value in the system-properties. As spring reloads the logback config at least once, the next run can access the value from the previous run.
Note: we do not really rely on this issue if our use cases could be solved in an other way
Our use cases
1. We want to include an optional properties file (which might not exist)
This does not work, because there is no optional support for property and the produced error will prevent spring to run the application
Current solution:
<!-- We define a property, that evaluates to "true", if the file exists -->
<definename="APPLICATION_LOCAL_EXISTS"class="ch.qos.logback.core.property.FileExistsPropertyDefiner"scope="system">
<path>config/application-local.properties</path>
</define>
<!-- if file exists, we include application-local.properties-true.inc.xml. If the property file does not exist, no XML is found. This works, because 'include' supports 'optional=true' -->
<includeresource="logback/application-local.properties-${APPLICATION_LOCAL_EXISTS}.inc.xml"optional="true"/>
<!-- content of application-local.properties-true.inc.xml -->
<included>
<propertyfile="config/application-local.properties"/>
</included>
Yes this is a workaround, and I'm sure it was not intended to use it this way, but it did work with 1.2
By default we want to use the CONSOLE appender, we have also other appenders like CONSOLE_ANSI, CONSOLE_JSON which formats the output to console in a different way.
If we put all appenders "ready for use" in the logback.xml we get warnings like Appender named [CONSOLE_ANSI] not referenced. Skipping further processing. - so we split them up into a CONSOLE.appender.inc.xml, CONSOLE_ANSI.appender.inc.xml, CONSOLE_JSON.inc.xml and include the dedicated file with
Hello, we are facing the same issue mentioned in https://jira.qos.ch/browse/LOGBACK-1731 and we hoped, it will be fixed in 1.4.12 (as it is listed in fix-versions)
It seems that there was a change in when we migrated from 1.2 to 1.4
Using
scope="system"
seems to work in spring.It seems that there is some logical order problem
As far as I could debug the issue, logback builds a "Model" which represents the complete config (with all included files)
and then, the properties are evolved. So due this order problem, it is not possible to use parameters in
include
tags. (Note: I'm not very familiar with the architecture in logback, so this is just a guess, what I've ssen in debugger)When you apply
scope="system"
- logback puts the value in the system-properties. As spring reloads the logback config at least once, the next run can access the value from the previous run.Note: we do not really rely on this issue if our use cases could be solved in an other way
Our use cases
1. We want to include an optional properties file (which might not exist)
Preferred solution:
This does not work, because there is no
optional
support forproperty
and the produced error will prevent spring to run the applicationCurrent solution:
Yes this is a workaround, and I'm sure it was not intended to use it this way, but it did work with 1.2
possible fix
Add 'optional' to 'property'
2. We want to include different appenders.
By default we want to use the
CONSOLE
appender, we have also other appenders likeCONSOLE_ANSI
,CONSOLE_JSON
which formats the output to console in a different way.If we put all appenders "ready for use" in the logback.xml we get warnings like
Appender named [CONSOLE_ANSI] not referenced. Skipping further processing.
- so we split them up into a CONSOLE.appender.inc.xml, CONSOLE_ANSI.appender.inc.xml, CONSOLE_JSON.inc.xml and include the dedicated file withpossible fix
Add 'optionalUse' to 'appender'. If this is set, no warnings are printed, if appender is not in use.
The text was updated successfully, but these errors were encountered: