[logback-user] (Important) Dynamically change the scan period

ceki ceki at qos.ch
Mon Apr 8 15:10:55 CEST 2013

Hi Siva,

The code that scans for changes in the config file has a guard which 
will actually look for the change only after several logger method 
calls. In logback version 1.0.1 and earlier, that number was fixed at 
16. In version 1.0.2 and later, the number of required logger 
invocations is adjusted dynamically. It can be as low as 16 and can go 
up to 2^16 in very busy systems.

As long as you wait 2 seconds (per your settings) and have 16 or more 
logger invocations, the changes in your config file will be picked up.


On 08.04.2013 14:49, simplysivu wrote:
> Hi,
> I am using logback for restful webservices over jersey api.. using apache
> server.
> I have created logback file like the following...
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration scan="true" scanPeriod="2 seconds">
>    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender" >
>      <encoder>
>        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
> %msg%n</pattern>
>      </encoder>
>    </appender>
>    <root level="debug">
>      <appender-ref ref="STDOUT" />
>    </root>
> </configuration>
> and in my code i have written..
> Logger logger = LoggerFactory.getLogger(AuthenticateResource.class);
>                  logger.debug("Hello world.");
> when i run my code..
> Hello world is being displayed..
> now if i change my root level to info in logback.xml and if i run the code
> without restarting the server.
> Hello world is being displayed..
> but, it should not be displayed..
> Do I need to add anything such that the file loads automatically and stop
> debug messages to display without restarting my server.
> thanks and regards,
> Siva.

65% of statistics are made up on the spot

More information about the Logback-user mailing list