[logback-user] logback 1.0 - pickup config change & reconfigure

Sean Kennedy Sean.Kennedy at VHI.IE
Thu Feb 2 13:43:41 CET 2012


Ceki, 
thanks, I'd already got the status listener servlet working..

I've simplified my application to 1 servet, hello world type setup, 
Logback will detect and reconfigure a change to an external logback.xml as expected,

However if <include file=...../> mechanism is used it detects the change to the included file but doesn't reconfigure !

Regards,
Sean





-----Original Message-----
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of ceki
Sent: 01 February 2012 16:25
To: logback users list
Subject: Re: [logback-user] logback 1.0 - pickup config change & reconfigure

Hi Sean,

The on console status listener [1] should give you more information as 
to what is going on. Just add the following line just after the 
<configuration> element in your top-most config file, i.e. logon.xml.

<statusListener
     class="ch.qos.logback.core.status.OnConsoleStatusListener" />

HTH,

--
Ceki


[1] http://logback.qos.ch/manual/configuration.html#statusListener

On 01.02.2012 17:04, Sean Kennedy wrote:
> Hi,
>
> I'm trying to get logback to read an external config xml and "scan" it
> for changes,
>
> I've setup an entry in web.xml and done it via an include..
>
> All looks good when I run it, change is detected in external file , but
> changes to fillter logging levels are ignored, in fact if I blank the
> entire external file it's also ignored !!
>
>  From ready various other posts this should be possible , it was fixed
> in 0.9.16 but perhaps I've missed something fundamental
>
> I've changed the filter up to ERROR and I still get INFO output !!
>
> Web.xml
>
> <env-entry>
>
> <env-entry-name>_logback_-file</env-entry-name>
>
> <env-entry-type>java.lang.String</env-entry-type>
>
> <env-entry-value>C:/logback_properties/_localhost_/logon.xml</env-entry-value>
>
> </env-entry>
>
> Logback.xml
>
> <configurationscan=/"true"/ scanPeriod=/"10 seconds"/ debug=/"true"/ >
>
> <insertFromJNDIenv-entry-name=/"java:comp/env/logback-file"/
> as=/"logback-file"/ />
>
> <includefile=/"${logback-file}"/ />
>
> </configuration>
>
> Logon.xml [i.e. external file]
>
> <?xmlversion=/"1.0"/ encoding=/"UTF-8"/?>
>
> <included>
>
> <appendername=/"A1"/
> class=/"ch.qos.logback.core.rolling.RollingFileAppender"/>
>
> <filterclass=/"ch.qos.logback.classic.filter.ThresholdFilter"/>
>
> <level>INFO</level>
>
> </filter>
>
> <File>C:/logs/_localhost_/logon.log</File>
>
> <encoder>
>
> <pattern>%d{ISO8601} %-5p %c - %m%n</pattern>
>
> </encoder>
>
> <rollingPolicyclass=/"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"/>
>
> <fileNamePattern>C:/logs/_localhost_/logon.log.%d</fileNamePattern>
>
> <maxHistory>2</maxHistory>
>
> </rollingPolicy>
>
> </appender>
>
> <rootlevel=/"DEBUG"/>
>
> <appender-refref=/"A1"//>
>
> </root>
>
> </included>
>
_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list