I am using a third-party library which has a log4j.xml configuration - what's the best way to turn off the logging?
Asked
Active
Viewed 2.1k times
10
-
Are you trying remove ALL logging or just from this third party library? – James McMahon Aug 07 '09 at 13:33
-
I'm trying to remove ALL logging. Everything! – Corehpf Aug 07 '09 at 13:44
5 Answers
17
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
- 608
- 4
- 10
2
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
- 11,112
- 4
- 47
- 55
0
You could also try setting the logging level to "Severe" if you only want to log game-breaking events.

Justin
- 9,419
- 7
- 34
- 41
0
With log4j.xml the minimal solution looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration threshold="off">
</log4j:configuration>
Note that in threshold="off"
, "off" must be in lower case.

user1433852
- 162
- 1
- 11