logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dr. Evil" <dre...@sidereal.kz>
Subject Re: AW: AW: Changing logging levels at runtime
Date Thu, 14 Feb 2002 09:26:09 GMT

Again, it doesn't need to work dynamicly.  I can restart the server,
reboot the machine, reinstall the OS, anything, it doesn't matter.  I
just want it to not log DEBUG level messages.  I think I can turn off
all logging by making it log to /dev/null, but it would be fantastic
if it could log only some messages but not others...

> here is the configuration of log4j on my local machine:
> 
> -------------------- log4j.properties on D: -----------
> #all classes have priority debug
> log4j.rootCategory=DEBUG,R
> 
> #store all log information using the following appender
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> 
> #store log information in the following file
> log4j.appender.R.File=e:\\log4j.log
> 
> #define the size of log files
> log4j.appender.R.MaxFileSize=10000KB
> 
> #define number of backup files
> log4j.appender.R.MaxBackupIndex=10
> 
> #define layout for log information
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> 
> #define the conversion pattern
> log4j.appender.R.layout.ConversionPattern=%d{DATE} [%t] %-5p %c:%M:%L - %m%n
> 

Thanks for the sugestion.  I tried that, setting log4j.rootCategory to
INFO and restarted the server and it didn't prevent it from logging
DEBUG events.  I set it to OFF, and it still logs everything.  The FAQ
really makes it sound like being able to configure log4j by changing a
config file is one of log4j's main advantages, but this doesn't seem
to be possible.  Please don't tell me that I need edit thousands of
lines of source code to turn logging off...  If this is how log4j
works, are there some alternative packages that let me distinguish
different severity categories?

Or is there a bug in the log4j version I am using?  It is version
1.1.3.  I am running Sun's Java(TM) 2 Runtime Environment, Standard
Edition (build 1.3.1_02-b02), Java HotSpot(TM) Client VM (build
1.3.1_02-b02, mixed mode) under Redhat 7.2, on an AMD Duron system.
Will this work?

Btw, here is the code in my Listener that starts the logging:

        System.out.println("Starting the logger");
        PropertyConfigurator.configure
 ("/usr/local/jakarta-tomcat-4.0.1/webapps/ROOT/WEB-INF/classes/log4j.properties");

I put it in a Listener, instead of a load-on-startup servlet, because
I actually want logging to start before any servlets start, and so
what I do is create a Listener to listen for a context initialization
event, which is the first thing that the Tomcat user can access.

Thanks for any help.  It seems like it should be trivial to put in a
line in a file that says "don't log DEBUG messages" but it doesn't
seem to be so easy as that.

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message