欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Log4j配置

程序员文章站 2022-06-09 10:12:29
...
log4j.rootLogger=debug, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=[S] %-5p %C.%M(%F:%L)%m %n





log4j.rootLogger=debug, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

#log4j.appender.stdout.layout.ConversionPattern=[C] %p [%t] %C.%M(%L) | %m%n
log4j.appender.stdout.layout.ConversionPattern= [C] %-5p %C.%M(%F:%L)%m %n
#log4j.appender.stdout.layout.ConversionPattern=%p %d{HH:mm:ss} %m%n
#%p [%t] %C.%M(%L) | %m%n
#%m 输出代码中指定的消息
#%p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
#%r 输出自应用启动到输出该log信息耗费的毫秒数
#%c 输出所属的类目,通常就是所在类的全名
#%t 输出产生该日志事件的线程名
#%n 输出一个回车换行符,Windows平台为“rn”,Unix平台为“n”
#%d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式
#比如:%d{yyyy MMM dd HH:mm:ss,SSS} 输出类似:2002年10月18日 22:10:28,921
#%l 输出日志事件的发生位置,包括类目名、发生的线程,以及在代码中的行数。
#[Log4JDemo]是log信息的开头,可以为任意字符,一般为项目简称。

# You can change this to be an absolute path or even an environment variable
# If you're using an environment variable, you will have to set JAVA_OPTS
# to contain this variables - for example in the catalina.sh or catalina.bat
# file

#log4j.appender.R.File=@APPNAME@.log

#log4j.appender.R.MaxFileSize=100KB

# Don't keep a backup file
#log4j.appender.R.MaxBackupIndex=0

#log4j.appender.R.layout=org.apache.log4j.PatternLayout
#log4j.appender.R.layout.ConversionPattern=%d{yyy MMM dd HH:mm:ss,SSS} %p %c - %m%n

# Configuration for receiving e-mails when ERROR messages occur.
#log4j.appender.mail=org.apache.log4j.net.SMTPAppender
#log4j.appender.mail.To=@ERROR-MAILTO@
#log4j.appender.mail.From=@ERROR-SERVER@@raibledesigns.com
#log4j.appender.mail.SMTPHost=@ERROR-MAILHOST@
#log4j.appender.mail.Threshold=ERROR
#log4j.appender.mail.BufferSize=1
#log4j.appender.mail.Subject=[@ERROR-SERVER@] @APPNAME@ Application Error

#log4j.appender.mail.layout=org.apache.log4j.PatternLayout
#log4j.appender.mail.layout.ConversionPattern=%d{yyy MMM dd HH:mm:ss,SSS} %-5p %c %x - %m%n

# If programmed properly the most messages would be at DEBUG 
# and the least at FATAL.
#log4j.logger.com.bjnkd=DEBUG
#log4j.logger.com.bjnkd.webapp.filter=ERROR
#log4j.logger.com.bjnkd.webapp.listener.UserCounterListener=WARN
#log4j.logger.com.bjnkd.util=WARN

# Control logging for other open source packages
#log4j.logger.com.opensymphony.oscache=ERROR
#log4j.logger.net.sf.navigator=ERROR
#log4j.logger.net.sf.acegisecurity=WARN
#log4j.logger.net.sf.acegisecurity.intercept.event.LoggerListener=WARN
#log4j.logger.org.apache.commons=ERROR
#log4j.logger.org.apache.struts=WARN
#log4j.logger.org.displaytag=ERROR
#log4j.logger.org.springframework=WARN
#log4j.logger.com.ibatis.db=WARN
#log4j.logger.org.apache.velocity=WARN

# Don't show debug logs for WebTest
#log4j.logger.com.canoo.webtest=WARN

# All hibernate log output of "info" level or higher goes to stdout.
# For more verbose logging, change the "info" to "debug" on the last line.
#log4j.logger.org.hibernate.ps.PreparedStatementCache=ERROR
#log4j.logger.org.hibernate=ERROR

# Changing the log level to DEBUG will result in Hibernate generated
# SQL to be logged.
#log4j.logger.org.hibernate.SQL=ERROR

# Changing the log level to DEBUG will result in the PreparedStatement
# bound variable values to be logged.
#log4j.logger.org.hibernate.type=ERROR