[logback-user] A new ReconfigureOnChangeFilter at each reload of the config file

Ceki Gulcu ceki at qos.ch
Wed Jul 20 23:10:31 CEST 2011


On 20.07.2011 22:56, dunand wrote:
>
>
>
> Ceki Gulcu wrote:
>>
>> By the way, what is the value of
>> LOGBACK_CONFIG_FILE_PARAMETER?
>>
>
> I'm using : "C:\tmp\logging\logback.xml"
> I also tried "\\server\x\y\logback.xml" with the same output.

OK. The configuration file is external to your application. You can 
package logback.xml within your web-app and include 
C:\tmp\logging\logback.xml from logback.xml:

Example logback.xml file:

<configuration scan="true">
   <include file="C:\tmp\logging\logback.xml"/>
</configuration>


The included file must list its contents within <included> element. See 
[1]. The file C:\tmp\logging\logback.xml becomes:

<included>
   <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
     <encoder>
       <pattern>...</pattern>
     </encoder>
   </appender>

   <root level="debug">
     <appender-ref ref="STDOUT" />
   </root>
<included>

With this inclusion trick you no longer need initialization code in 
ServletContextListener.

By the way, another alternative is the logback.configurationFile system 
property. See [2] for more details.

[1] http://logback.qos.ch/manual/configuration.html#fileInclusion
[2] http://logback.qos.ch/manual/configuration.html#configFileProperty


More information about the Logback-user mailing list