You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2002/03/08 23:00:03 UTC

Re: Changing the priority level at runtime

Here is a short comment:

Log4j normally needs to be configured only once. Some new users try to 
configure log4j
in each and every class. This is very inefficient and just plain wrong.

HTH, Ceki

At 23:45 08.03.2002 -0800, you wrote:
>Hi
>
>  I have two packages and each package has two classes each. If I set the 
> priority level of each class to FATAL , and in the configuration file if 
> I set the priority level of the first package com.foo.a to FATAL and the 
> priority level of second package com.foo.b to DEBUG.  So now I have set 
> levels for four classes and two packages. My question is if i have to 
> change the priority level for any class or package programmaticly  on the 
> fly without touching the config file can I do that or not. At this time 
> if I dont comment the priority level of the classes the packages work and 
> classes dont and vice versa. Here is my config file.....
>
>log4j.rootCategory=DEBUG, A1
>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>
>
>log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
>
>log4j.category.com.foo.a=ERROR
>log4j.category.com.foo.b=DEBUG
>
>log4j.category.com.foo.a.AA=FATAL
>log4j.category.com.foo.a.AB=FATAL
>log4j.category.com.foo.b.BB=FATAL
>log4j.category.com.foo.b.BA=FATAL
>
>when I run the class BB which has the main methid (this class instantiate 
>all other classes) it doesnt print anything on the console. If I comment 
>the classes it works.
>
>Each class has these lines in the construtor
>.
>PropertyConfigurator.configure("multi.properties");
>      debugger.info("This is b.BA");
>
>and so on. My question is without commenting any of the lines in Log4j can 
>I make it work and if I have to change the level of any of these classes 
>or packages at runtime without editing the configuration file will that work.
>I appreciate your patience
>Thankyou
>Asad

--
Ceki


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>