Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn logging off using log4j?

I am using a third-party library which has a log4j.xml configuration - what's the best way to turn off the logging?

like image 597
Corehpf Avatar asked Aug 07 '09 12:08

Corehpf


2 Answers

I think all that is required is to set the threshold parameter to OFF

<log4j:configuration threshold="OFF">
    <root>
        <priority value ="off" />
        <appender-ref ref="console" />
        <appender-ref ref="rolling-file" />
    </root>
</log4j:configuration>
like image 166
John McG Avatar answered Sep 21 '22 20:09

John McG


Or directly from code:

Logger.getRootLogger().removeAllAppenders();
like image 28
Karl Avatar answered Sep 23 '22 20:09

Karl