java program to search a log file and trigger email when an error encounters
<p>I have configured the log4j xml to send e-mail when an error encounters in my application, but still i could not get any mails.Could you please suggest me if i have to do something else other than this configuration.Below is the configuration done in xml file for e-mails</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;
&lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true"&gt;
&lt;appender name="XMPAYROLAppender"
        class="org.apache.log4j.DailyRollingFileAppender"&gt;
        &lt;param name="File" value="log/XMPAYROLLogger.log" /&gt;
        &lt;param name="datePattern" value="'.'yyyy-MM-dd" /&gt;
        &lt;param name="append" value="true" /&gt;
        &lt;param name="Encoding" value="UTF-8" /&gt;
        &lt;layout class="org.apache.log4j.PatternLayout"&gt;
            &lt;param name="ConversionPattern" value="%d [%t] %-5p %C{1} - %m%n" /&gt;
        &lt;/layout&gt;
&lt;/appender&gt;
&lt;appender name="AdministratorEmail" class="org.apache.log4j.net.SMTPAppender"&gt;
  &lt;param name="BufferSize" value="1024" /&gt;
  &lt;param name="SMTPHost" value="smtp.gmail.com" /&gt;
  &lt;param name="From" value="kiran98373@gmail.com" /&gt;
  &lt;param name="To" value="kiran98373@gmail.com.com" /&gt;
  &lt;param name="Subject" value="test mail" /&gt;
  &lt;layout class="org.apache.log4j.PatternLayout"&gt;
    &lt;param name="ConversionPattern"
      value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" /&gt;
  &lt;/layout&gt;
  &lt;filter class="org.apache.log4j.varia.LevelRangeFilter"&gt;
    &lt;param name="LevelMin" value="error" /&gt;
    &lt;param name="LevelMax" value="fatal" /&gt;
  &lt;/filter&gt;
&lt;/appender&gt;

&lt;logger name="XMPAYROLLogger" additivity="true"&gt;
        &lt;level class="org.apache.log4j.Level" value="INFO" /&gt;
        &lt;appender-ref ref="XMPAYROLAppender" /&gt;
&lt;/logger&gt;
&lt;/log4j:configuration&gt;
</code></pre>
