这是我的 log4j.properties 文件。我使用 LOCAL1 作为 SYSLOG 工具:
log4j.rootLogger=DEBUG, R, stdout ,SYSLOG_LOCAL1
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${CATALINA_HOME}logs/mylweb.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=100
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.category.org.springframework=INFO
log4j.category.org.directwebremoting=INFO
log4j.category.org.apache.http=INFO
log4j.appender.SYSLOG_LOCAL1=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG_LOCAL1.threshold=DEBUG
log4j.appender.SYSLOG_LOCAL1.syslogHost=localhost
log4j.appender.SYSLOG_LOCAL1.facility=Local1
log4j.appender.SYSLOG_LOCAL1.facilityPrinting=true
log4j.appender.SYSLOG_LOCAL1.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG_LOCAL1.layout.conversionPattern=%d %p [%c] - %m%n