我已将 log4j xml 配置为在我的应用程序中遇到错误时发送电子邮件,但我仍然无法收到任何邮件。如果我必须执行此配置以外的其他操作,请您建议我。以下是配置完成在电子邮件的 xml 文件中
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<appender name="XMPAYROLAppender"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="log/XMPAYROLLogger.log" />
<param name="datePattern" value="'.'yyyy-MM-dd" />
<param name="append" value="true" />
<param name="Encoding" value="UTF-8" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %C{1} - %m%n" />
</layout>
</appender>
<appender name="AdministratorEmail" class="org.apache.log4j.net.SMTPAppender">
<param name="BufferSize" value="1024" />
<param name="SMTPHost" value="smtp.gmail.com" />
<param name="From" value="kiran98373@gmail.com" />
<param name="To" value="kiran98373@gmail.com.com" />
<param name="Subject" value="test mail" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="error" />
<param name="LevelMax" value="fatal" />
</filter>
</appender>
<logger name="XMPAYROLLogger" additivity="true">
<level class="org.apache.log4j.Level" value="INFO" />
<appender-ref ref="XMPAYROLAppender" />
</logger>
</log4j:configuration>