Here's the list of logger categories:
Formatted for pasting into a log4j XML configuration file:
NB: Most of the loggers use the DEBUG level, however org.hibernate.type uses TRACE. In previous versions of Hibernate org.hibernate.type also used DEBUG, but as of Hibernate 3 you must set the level to TRACE (or ALL) in order to see the JDBC parameter binding logging.
And a category is specified as such:
It must be placed before the root element.
|
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Showing posts with label log4j. Show all posts
Showing posts with label log4j. Show all posts
Monday, September 19, 2016
Hibernate : log4j.xml logging category and binding parameters
Thursday, July 7, 2016
Log4j : logging one package to log file and another package to another logfile ... on different levels.
Sending the only com.dashboard.process [debug] information to a file.... AND
Sending the info messages of com.dashboard [info] information to another file including the info
messages of com.dashboard.process.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration>
<!-- an appender is an output destination, such as the console or a file; names of appenders are arbitrarily chosen -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d %-5p %c{1} (%F:%L) %m%n" />
</layout>
</appender>
<appender name="stderr" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.err" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t][%F:%L] : %m%n" />
</layout>
</appender>
<appender name="file" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${log4j.dir}/dashboard.log" />
<param name="MaxFileSize" value="2Mb" />
<param name="MaxBackupIndex" value="5" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t][%F:%L] : %m%n" />
</layout>
</appender>
<appender name="harvestor" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${log4j.dir}/dashboard-harvest.log" />
<param name="MaxFileSize" value="2Mb" />
<param name="MaxBackupIndex" value="5" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t][%F:%L] : %m%n" />
</layout>
</appender>
<category name="org.springframework.ui.velocity">
<priority value="WARN" />
</category>
<category name="org.springframework.web.servlet.view.velocity">
<priority value="WARN" />
</category>
<category name="org.apache.velocity.runtime">
<priority value="WARN" />
</category>
<category name="org.springframework.web.util" additivity="false">
<priority value="WARN" />
</category>
<category name="org.eclipse.jetty.servlet">
<priority value="WARN" />
</category>
<category name="com.dashboard.process" additivity="false">
<priority value="DEBUG"></priority>
</category>
<category name="com.dashboard" additivity="true">
<priority value="INFO"></priority>
</category>
<!-- the root category -->
<!-- all log messages of level "debug" or higher will be logged, unless defined otherwise all log messages will be logged to the appender
"stdout", unless defined otherwise -->
<logger name="com.dashboard">
<level value="INFO" />
<appender-ref ref="file" />
</logger>
<logger name="com.dashboard.process" additivity="false">
<level value="DEBUG" />
<appender-ref ref="harvestor" />
</logger>
</log4j:configuration>
Wednesday, March 14, 2012
Please Log Everything with a Log4j.xml to my screen....
It's sad to put this down however every time I need it, I forget the syntax... whats the proper syntax to answer my "please log everything to the screen" question...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration>
<!--
an appender is an output destination, such as the console or a file;
names of appenders are arbitrarily chosen
-->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c (%F:%L) %m%n"/>
</layout>
</appender>
<appender name="stderr" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.err"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t][%F:%L] : %m%n" />
</layout>
</appender>
<!-- the root category -->
<!--
all log messages of level "debug" or higher will be logged, unless defined otherwise
all log messages will be logged to the appender "stdout", unless defined otherwise
-->
<root>
<priority value="ALL"/>
<appender-ref ref="stdout" />
<appender-ref ref="stderr" />
</root>
</log4j:configuration>
Subscribe to:
Posts (Atom)