logback 1.0 - pickup config change & reconfigure

View: New views
4 Messages — Rating Filter:   Alert me  

logback 1.0 - pickup config change & reconfigure

by Sean Kennedy-12 :: Rate this Message:

| View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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

<configuration scan="true" scanPeriod="10 seconds" debug="true" >

<insertFromJNDI env-entry-name="java:comp/env/logback-file" as="logback-file" />

<include file="${logback-file}" />

</configuration>

 

Logon.xml  [i.e. external file]

 

<?xml version="1.0" encoding="UTF-8"?>

<included>

 

  <appender name="A1" class="ch.qos.logback.core.rolling.RollingFileAppender">

  

    <filter class="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>

 

    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">

      <fileNamePattern>C:/logs/localhost/logon.log.%d</fileNamePattern>

      <maxHistory>2</maxHistory>

    </rollingPolicy>

 

  </appender>

 

  <root level="DEBUG">

    <appender-ref ref="A1"/>

  </root>

 

</included>


_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: logback 1.0 - pickup config change & reconfigure

by Ceki Gulcu :: Rate this Message:

| View Threaded | Show Only this Message

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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: logback 1.0 - pickup config change & reconfigure

by Sean Kennedy-12 :: Rate this Message:

| View Threaded | Show Only this Message

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@... [mailto:logback-user-bounces@...] 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: logback 1.0 - pickup config change & reconfigure

by Sean Kennedy-12 :: Rate this Message:

| View Threaded | Show Only this Message

Ceki,
 I've rolled back to use version 0.9.28 and all code works perfectly without a change
Regards,
Sean


-----Original Message-----
From: logback-user-bounces@... [mailto:logback-user-bounces@...] 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user