(Important) Dynamically change the scan period

hi all, i have migrated to logback to be able to change the log levels dynamically. i'm testing it now with calssfish 3.01 and somehow it is not working when i change the levels in logback.xml there nothing happens. by deploying from netbeans i get the following: |-INFO in ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter@11bfee0 - Will scan for changes in [[C:\Dokumente und Einstellungen\user_Home\Eigene Dateien\NetBeansProjects\WS-LDAP\build\web\WEB-INF\classes\logback.xml]] every 15 seconds. but when i change the levels in this file nothing happens Any help will be appreciated Hugirat -- إِنَّ الَّذِينَ يُحِبُّونَ أَنْ تَشِيعَ الْفَاحِشَةُ فِي الَّذِينَ آمَنُوا لَهُمْ عَذَابٌ أَلِيمٌ فِي الدُّنْيَا وَالآخِرَةِ وَاللَّهُ يَعْلَمُ وَأَنْتُمْ لا تَعْلَمُونَ My public key please use it when you contact me: هذا مفتاحي العام الرجاء أستخدامه عند الإتصال بي: 09BA B710 4B98 ECDA 8C0A 6CB1 2E1E CF88 6A12 F2C3

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. -- View this message in context: http://logback.10977.n7.nabble.com/Important-Dynamically-change-the-scan-per... Sent from the Users mailing list archive at Nabble.com.

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. HTH, 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.
-- Ceki 65% of statistics are made up on the spot

Thanks a lot Ceki.. Its working now.. I haven't found that point in the tutorial. Regards, Siva. -- View this message in context: http://logback.10977.n7.nabble.com/Important-Dynamically-change-the-scan-per... Sent from the Users mailing list archive at Nabble.com.

On 08.04.2013 18:38, simplysivu wrote:
Thanks a lot Ceki.. Its working now.. I haven't found that point in the tutorial.
It mentioned at at [1] although the information could be highlighted. I'll do that. [1] http://logback.qos.ch/manual/configuration.html#autoScan
Regards, Siva.
-- Ceki 65% of statistics are made up on the spot
participants (3)
-
ceki
-
simplysivu
-
Yihya Hugirat