Log4j配置

#

# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)

#

# The five logging levels used by Log are (in order):

#

#   1. DEBUG (the least serious)

#   2. INFO

#   3. WARN

#   4. ERROR

#   5. FATAL (the most serious)

# Set root logger level to WARN and append to stdout

log4j.rootLogger=WARN,stdout,MAIL

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

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

log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n

###Struts

#log4j.logger.com.opensymphony=WARN

#log4j.logger.org.apache.struts2=WARN

###Spring

#log4j.logger.org.springframework=WARN

###Ibaits

#log4j.logger.com.ibatis=debug

#log4j.logger.com.ibatis.common.jdbc.ScriptRunner=debug

#log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debug

#log4j.logger.java.sql.Connection=debug

#log4j.logger.java.sql.Statement=debug

#log4j.logger.java.sql.PreparedStatement=debug

###Log配置某个类的Log4j输出级别

log4j.logger.com.base.model.util.Log=DEBUG

###LogMail

log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender

# 日志的错误级别

log4j.appender.MAIL.Threshold=ERROR

# 缓存文件大小,日志达到1K时发送Email

log4j.appender.MAIL.BufferSize=1

# 发送邮件的服务器#smtp.qq.com

log4j.appender.MAIL.SMTPHost=mail.metplanet.com

# 发送邮件的服务端口

#log4j.appender.MAIL.SMTPPort=25

# 邮件的标题

log4j.appender.MAIL.Subject=Web_ExceptionMessage

# 用户名[email protected]

log4j.appender.MAIL.SMTPUsername=dev

# 密码melplanet

log4j.appender.MAIL.SMTPPassword=dev

# 发送邮件debug模式

log4j.appender.MAIL.SMTPDebug=false

# 发件人地址

[email protected]

# 日志邮件的接收者

[email protected]

# 日志PatternLayout

log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout

# 日志的格式

log4j.appender.MAIL.layout.ConversionPattern=[ErrorMessage] %d - %c -%-4r [%t] %-5p %c %x - %m%n

相关推荐