日志文件源代码:
(可以适用于javaweb中的hibernate调式、hadoop运行程序调式)
# Root logger option
log4j.rootLogger=INFO, console
log4j.logger.com.ch.demo=INFO, console
# Direct log messages to console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{HH:mm}| %p | %F %L | %m%n
# direct messages to file hibernate.log
log4j.logger.org.hibernate=INFO, hibernate
log4j.appender.hibernate=org.apache.log4j.RollingFileAppender
log4j.appender.hibernate.File=hibernate.log
log4j.appender.hibernate.layout=org.apache.log4j.PatternLayout
log4j.appender.hibernate.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} %5p %c{1}\:%L - %m%n