Last active
October 15, 2016 03:30
-
-
Save thergbway/ce140f1451ca78ee4e7619fd514eee79 to your computer and use it in GitHub Desktop.
LOG4J XML CONFIGURATION. PUT IT ON CLASSPATH ROOT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | |
<appender name="stdout" class="org.apache.log4j.ConsoleAppender"> | |
<param name="Target" value="System.out"/> | |
<layout class="org.apache.log4j.PatternLayout"> | |
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n"/> | |
</layout> | |
</appender> | |
<!--Turn on your favourite loggers--> | |
<logger name="org.hibernate"> | |
<level value="INFO"/><!--or DEBUG for more verbose logging--> | |
</logger> | |
<logger name="org.hibernate.SQL"> | |
<level value="DEBUG"/> | |
</logger> | |
<root> | |
<level value="WARN"/> | |
<appender-ref ref="stdout"/> | |
</root> | |
</log4j:configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |
log4j.appender.stdout.Target=System.out | |
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n | |
# set up root logger level | |
log4j.rootLogger=warn, stdout | |
# set up your favourite loggers levels | |
log4j.logger.org.hibernate=info | |
log4j.logger.org.hibernate.SQL=info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
More verbose | |
------------ | |
* TRACE | |
* DEBUG | |
* INFO | |
* WARN | |
* ERROR | |
* FATAL | |
------------ | |
Less verbose | |
Custom log level are supported |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
private static Logger log = Logger.getLogger(Main.class); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment