log4j常用配置
0
log4j.rootLogger=info, FILE, Console
#这个选项用于控制监控logger的日志不会输出到rootlogger,否则无论会产生许多重复的数据,同时也会影响性能
log4j.additivity.monitorLogger=false
#文件
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File=logs/www.acgist.com.log
log4j.appender.FILE.Append=true
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.BufferedIO=true
log4j.appender.FILE.BufferSize=8192
log4j.appender.FILE.layout.ConversionPattern=[www.acgist.com] %d %-10r %-10p [%t] %40c %x --%m %n
log4j.appender.FILE.encoding=UTF-8
#控制台
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=[www.acgist.com] %d %-10r %-10p [%t] %40c %x --%m %n
#SOCKET
#log4j.appender.SOCKET=org.apache.log4j.RollingFileAppender
#log4j.appender.SOCKET.Port=5001
#log4j.appender.SOCKET.RemoteHost=localhost
#log4j.appender.SOCKET.LocationInfo=true
#log4j.appender.SOCKET.layout=org.apache.log4j.PatternLayout
#log4j.appender.SOCKET.layout.ConversionPattern=[www.acgist.com] %d %-10r %-10p [%t] %40c %x --%m %n
#邮件
#log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
#log4j.appender.MAIL.Threshold=FATAL
#log4j.appender.MAIL.BufferSize=10
#log4j.appender.MAIL.From=admin@acgist.com
#log4j.appender.MAIL.SMTPHost=www.wusetu.com
#log4j.appender.MAIL.Subject=Log4J Message
#log4j.appender.MAIL.To=rei@acgist.com
#log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
#log4j.appender.MAIL.layout.ConversionPattern=[www.acgist.com] %d %-10r %-10p [%t] %40c %x --%m %n
#数据库
#log4j.appender.DATABASE=org.apache.log4j.jdbc.JDBCAppender
#log4j.appender.DATABASE.URL=jdbc:mysql://localhost:3306/acgist
#log4j.appender.DATABASE.driver=com.mysql.jdbc.Driver
#log4j.appender.DATABASE.user=
#log4j.appender.DATABASE.password=
#log4j.appender.DATABASE.sql=INSERT INTO LOG4J (message) VALUES ('[www.acgist.com] %d %-10r %-10p [%t] %40c %x --%m %n')
#log4j.appender.DATABASE.layout=org.apache.log4j.PatternLayout
#log4j.appender.DATABASE.layout.ConversionPattern=[www.acgist.com] %d %-10r %-10p [%t] %40c %x --%m %n