logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Saxtoft" ...@sondagsavisen.dk>
Subject Problem using SMTPAppender
Date Thu, 31 Aug 2006 12:06:07 GMT
I have been fiddling with SMPTAppender for a day now, so now I give up.
 
My problem is that when logging to SMTPAppender it does not send any e-mails. The logger I
use also logs to a file which works fine.
I have been using a TCP monitor to see if anything goes thru port 25, but it never gets a
connection.
 
In my program I log with priority "error", and my log4j.xml looks like the following. I use
localhost as SMTPHost in order to monitor the port 25. Can anyone see what I'm missing or
have done wrong?
 
<log4j:configuration>
  <appender name="MOBILE_APPENDER" class="org.apache.log4j.net.SMTPAppender">
    <param name="SMTPHost" value="localhost"/>
    <param name="To" value="to@mail.com <mailto:to@mail.com> "/ <mailto:ts@sondagsavisen.dk"/>
>
    <param name="From" value="from@mail.com"/ <mailto:from@mail.com"/> >
 <param name="BufferSize" value="1"/>
 <param name="Threshold" value="DEBUG"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p %c(%M:%L) - %m%n"/>
    </layout>
  </appender>
 
  <appender name="MOBILE_DEBUG" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="log/mobile_debug.log"/>
    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
    <param name="Threshold" value="DEBUG"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %-5p %c{1}(%M:%L)
- %m%n"/>
    </layout>
  </appender>
 
  <logger name="mobileLogger">
    <level value="debug"/>
    <appender-ref ref="MOBILE_APPENDER"/>
    <appender-ref ref="MOBILE_DEBUG"/>
  </logger>
</log4j:configuration>
 
And a small java program:
 
public class TestSmptAppender {
  private static final Logger logger = Logger.getLogger("mobileLogger");
  public static void main(String[] args) {
    System.out.println("1");
    logger.error("2");
    System.out.println("3");
  }
}
 

Kind regards

Thomas Saxtoft
Java-developer
 
Gladsaxe Møllevej 28
2860 Søborg
Tlf.: 39 57 75 31 (direkte)
Fax: 39 57 75 97
t.saxtoft@sondagsavisen.dk

Besøg os på: www.sondagsavisen.dk


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message