dcsimg
Completely turning off the logs
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Herve_Leung
Posted On:   Wednesday, October 16, 2002 07:07 AM

Is there a way to completely turn off the logs for a logger ?
By completely, I mean, I don't even want to see the log with the FATAL level.




Thanks.

Re: Completely turning off the logs

Posted By:   Herve_Leung  
Posted On:   Thursday, October 17, 2002 08:17 AM

I found that setting the level to OFF is working too.

Apparently, OFF's level is higher than FATAL.

This will avoid the creation of a new "trash" appender.

Re: Completely turning off the logs

Posted By:   Anonymous  
Posted On:   Thursday, October 17, 2002 02:46 AM

Yes. Create an appender which does´t log and add it as the only to the root-category. Then comment the other categories out.


...

...




...

Ant my code for the NullAppender is

package log4j;

import org.apache.log4j.*;
import org.apache.log4j.spi.LoggingEvent;


public class NullAppender extends AppenderSkeleton {
public boolean requiresLayout() {
return false;
}
protected void append(LoggingEvent event) {
}
public void close() {
}
}

I haven´t tried to configure the root-category without any appender. Maybe it works, too. :-)
About | Sitemap | Contact