views:

894

answers:

4

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

+2  A: 

Depends on configuration. Try something like:

<log4j:configuration>
    <root>
        <priority value ="off" />
        <appender-ref ref="console" />
        <appender-ref ref="rolling-file" />
    </root>
</log4j:configuration>

Check Log4jXmlFormat for more details.

Grzegorz Gierlik
A: 

You could also try setting the logging level to "Severe" if you only want to log game-breaking events.

Justin
+5  A: 

Or directly from code:

Logger.getRootLogger().removeAllAppenders();
+3  A: 

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>
John McG