log4j.rootLogger=DEBUG,CONSOLE,DATABASE,DAILYFILE,FILE,JMS,MAIL
log4j.addivity.org.apache=true
# 应用于控制台:CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.Encoding=GBK
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 用于数据库:DATABASE
log4j.appender.DATABASE=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.DATABASE.URL=jdbc:mysql://127.0.0.1:3306/log
log4j.appender.DATABASE.driver=com.mysql.jdbc.Driver
log4j.appender.DATABASE.user=root
log4j.appender.DATABASE.password=root
log4j.appender.DATABASE.Threshold=WARN
log4j.appender.DATABASE.sql=INSERT INTO LOG4J(stamp, thread, infolevel, class, messages) VALUES ('%d{yyyy-MM-dd HH:mm:ss}', '%t', '%p', '%l', '%m')
# INSERT INTO LOG4J (Message) VALUES ('[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n')
# 写入数据库中的表LOG4J的Message字段中,内容%d(日期)%c: 日志信息所在地(类名)%p: 日志信息级别%m: 产生的日志具体信息 %n: 输出日志信息换行
log4j.appender.DATABASE.layout=org.apache.log4j.PatternLayout
log4j.appender.DATABASE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 每天新建日志:DAILYFILE
log4j.appender.DAILYFILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DAILYFILE.File=/Users/ben/Downloads/birdben
log4j.appender.DAILYFILE.Encoding=GBK
log4j.appender.DAILYFILE.Threshold=DEBUG
log4j.appender.DAILYFILE.DatePattern=yyyy-MM-dd'.log'
log4j.appender.DAILYFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.DAILYFILE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L : %m%n
# 应用于文件:FILE
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=/Users/ben/Downloads/birdben.log
log4j.appender.FILE.Append=true
log4j.appender.FILE.Encoding=GBK
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 应用于JMS:JMS
## Configure 'jms' appender. You'll also need jndi.properties file in order to make it work
log4j.appender.JMS=org.apache.log4j.net.JMSAppender
log4j.appender.JMS.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
log4j.appender.JMS.ProviderURL=tcp://localhost:61616
log4j.appender.JMS.TopicBindingName=logTopic
log4j.appender.JMS.TopicConnectionFactoryBindingName=ConnectionFactory
# 发送日志给邮件:MAIL
log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
log4j.appender.MAIL.Threshold=DEBUG
log4j.appender.MAIL.BufferSize=10
log4j.appender.MAIL.From=birdnic@163.com
log4j.appender.MAIL.SMTPHost=smtp.163.com
log4j.appender.MAIL.SMTPUsername=birdnic@163.com
log4j.appender.MAIL.SMTPPassword=benwj1999
log4j.appender.MAIL.Subject=Log4J Message
log4j.appender.MAIL.To=1255120436@qq.com
log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
log4j.appender.MAIL.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 应用于文件回滚
log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLING_FILE.Threshold=ERROR
log4j.appender.ROLLING_FILE.File=/Users/ben/Downloads/rolling.log
log4j.appender.ROLLING_FILE.Append=true
log4j.appender.ROLLING_FILE.Encoding=GBK
log4j.appender.ROLLING_FILE.MaxFileSize=10KB
log4j.appender.ROLLING_FILE.MaxBackupIndex=1
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLING_FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n
# 应用于socket:SOCKET
log4j.appender.SOCKET=org.apache.log4j.RollingFileAppender
log4j.appender.SOCKET.RemoteHost=localhost
log4j.appender.SOCKET.Port=5001
log4j.appender.SOCKET.LocationInfo=true
# Set up for Log Facter 5
log4j.appender.SOCKET.layout=org.apache.log4j.PatternLayout
log4j.appender.SOCET.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD]%n%c[CATEGORY]%n%m[MESSAGE]%n%n
# Log Factor 5 Appender
log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender
log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000
# 自定义Appender
log4j.appender.im=net.cybercorlin.util.logger.appender.IMAppender
log4j.appender.im.host=mail.cybercorlin.net
log4j.appender.im.username=username
log4j.appender.im.password=password
log4j.appender.im.recipient=corlin@cybercorlin.net
log4j.appender.im.layout=org.apache.log4j.PatternLayout
log4j.appender.im.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n