Configure log4j error message Email notification

xiaoxiao2021-03-06  102

In most projects, we are all deployed to the client after development. For various reasons, the client's server is not accessible. This brings great inconvenience to our future tracking commissioning, of course, it is also a safe concern to we will reduce the security. It is just a good heart, just go online, see Log4J Configuring Log Information Email on Onjava.com. The tutorial sent, trying to test on your own machine, the configuration process is as follows: 1. Open log4j.properties file 2. RootLogger plus an appender, Mil, such as log4j.rootlogger = error, A1, Mail3. Configuration Appender information, add the following section of the following section below # Configuration for receiving e-mail. # Custom appenderLog4j.Appender.mail = org.apache.log4j.net.smtpappender # 错 错 错 级 Log4j.Appender .Mail.threshold = error # Cache file size, send emailog4j.appender.mail.buff4j.Appender.mail.buff4j.Appender.mail.buff4j.appender.mail.From=test@163.com # send mail server log4j.Appender .Mail.smtphost = SMTP.163.com # 邮 的 Title log4j.Appender.mail.subject = log4j message # log mail recipor log4j.appender.mail.to=test@163.com# log patternletlog4j.Appender.mail .Layout = org.apache.log4j.patternlayout # log format log4j.appender.mail.Layout.conversionPattern = [framework]% D-% C -% - 4R [% T]% -5p% C% X-% M % N or more files are tested, if you don't pass your own email send environment .Reference: http://www.onjava.com/pub/a/onjava/2004/09/29/smtp-logging.html

转载请注明原文地址:https://www.9cbs.com/read-104790.html

New Post(0)