Log4j Configuration: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
<priority value="OFF"/> | <priority value="OFF"/> | ||
</category> | </category> | ||
</pre> | |||
=Turning Logging Off for an Inner Class= | |||
If we have an inner class with its own Logging instance: | |||
<pre> | |||
package x.y.z; | |||
public class A { | |||
... | |||
public static class B { | |||
private static final Logger log = Logger.getLogger(B.class); | |||
... | |||
} | |||
} | |||
</pre> | |||
then we refer to that category from a log4j.xml file as follows: | |||
<pre> | |||
<log4j:configuration ...> | |||
... | |||
<category name="x.y.z.A$B"> | |||
<priority value="DEBUG"/> | |||
</category> | |||
... | |||
</log4j:configuration> | |||
</pre> | </pre> |
Revision as of 00:43, 8 August 2016
Internal
Turning Logging Off Completely for a Category
<category name="io.novaordis.test"> <priority value="OFF"/> </category>
Turning Logging Off for an Inner Class
If we have an inner class with its own Logging instance:
package x.y.z; public class A { ... public static class B { private static final Logger log = Logger.getLogger(B.class); ... } }
then we refer to that category from a log4j.xml file as follows:
<log4j:configuration ...> ... <category name="x.y.z.A$B"> <priority value="DEBUG"/> </category> ... </log4j:configuration>