本配置可以完美的输出数据库操作等日志信息;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
log4j.rootLogger=info, all
log4j.logger.org.springframework=info,spring, all ,stdout
log4j.logger.org.apache=info, all
log4j.logger.com.ibatis=debug, all ,stdout
log4j.logger.java.sql=debug, all ,stdout
log4j.logger.com.digital.smartjsmgr=debug, all ,stdout
log4j.logger.com.ibm=info, all ,stdout
log4j.logger.com.mchange=info, all ,stdout
# --------------- All Logger ------------------------------------------
log4j.appender. all           =org.apache.log4j.RollingFileAppender
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
log4j.appender. all .File     =../logs/ all .log
log4j.appender. all .BufferSize=100
log4j.appender. all .MaxFileSize        =500KB
log4j.appender. all .MaxBackupIndex =5
log4j.appender. all .layout               =org.apache.log4j.PatternLayout
log4j.appender. all .layout.ConversionPattern=%n+<%d{yyyy-MM-dd HH:mm:ss-S}><%l>%n+<%-5p> ---<%t><%m>%n
# -------------- Spring Logger ----------------------------------------
log4j.appender.spring          =org.apache.log4j.RollingFileAppender
log4j.appender.spring.File     =../logs/spring.log
log4j.appender.spring.BufferSize=100
log4j.appender.spring.MaxFileSize        =200KB
log4j.appender.spring.MaxBackupIndex =5
log4j.appender.spring.layout               =org.apache.log4j.PatternLayout
log4j.appender.spring.layout.ConversionPattern=%n+<%d{yyyy-MM-dd HH:mm:ss-S}><%l>%n+<%-5p> ---<%t><%m>%n
# -----------------stdout logger--------------------------------------
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 %5p %C:%M:%L - %m%n