测试类:
public class Test {
/**
* @param args
*/
public static final Logger logger = Logger.getLogger(Test.class);
public static void main(String[] args) {
//logger.debug("debug xxx");
}
}
log4j.properties配置
log4j.logger.com.jl=DEBUG,y_mail_logout
#--------------------------------------------------------------------#
log4j.appender.y_mail_logout=org.apache.log4j.net.SMTPAppender
log4j.appender.y_mail_logout.Threshold=ERROR
log4j.appender.y_mail_logout.BufferSize=512
log4j.appender.y_mail_logout.SMTPHost=mail.xxx.com
log4j.appender.y_mail_logout.Subject= Jlerp_y ErrorMessage
log4j.appender.y_mail_logout.SMTPUsername=jlerp
log4j.appender.y_mail_logout.SMTPPassword=11111
log4j.appender.y_mail_logout.From=jlerp@ejianlong.com
log4j.appender.y_mail_logout.To=[color=red]zhangsan@xxx.com,lisi@xxx.com[/color]
log4j.appender.y_mail_logout.layout=org.apache.log4j.PatternLayout
log4j.appender.y_mail_logout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} | %l | %p | %m%n
[color=gray]如果您觉得本文对您有益,请点击博文后的google广告,对作者表示支持,谢谢![/color]
public class Test {
/**
* @param args
*/
public static final Logger logger = Logger.getLogger(Test.class);
public static void main(String[] args) {
//logger.debug("debug xxx");
}
}
log4j.properties配置
log4j.logger.com.jl=DEBUG,y_mail_logout
#--------------------------------------------------------------------#
log4j.appender.y_mail_logout=org.apache.log4j.net.SMTPAppender
log4j.appender.y_mail_logout.Threshold=ERROR
log4j.appender.y_mail_logout.BufferSize=512
log4j.appender.y_mail_logout.SMTPHost=mail.xxx.com
log4j.appender.y_mail_logout.Subject= Jlerp_y ErrorMessage
log4j.appender.y_mail_logout.SMTPUsername=jlerp
log4j.appender.y_mail_logout.SMTPPassword=11111
log4j.appender.y_mail_logout.From=jlerp@ejianlong.com
log4j.appender.y_mail_logout.To=[color=red]zhangsan@xxx.com,lisi@xxx.com[/color]
log4j.appender.y_mail_logout.layout=org.apache.log4j.PatternLayout
log4j.appender.y_mail_logout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} | %l | %p | %m%n
[color=gray]如果您觉得本文对您有益,请点击博文后的google广告,对作者表示支持,谢谢![/color]