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
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?
  <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"/>
  <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"/>
  <logger name="mobileLogger">
    <level value="debug"/>
    <appender-ref ref="MOBILE_APPENDER"/>
    <appender-ref ref="MOBILE_DEBUG"/>
And a small java program:
public class TestSmptAppender {
  private static final Logger logger = Logger.getLogger("mobileLogger");
  public static void main(String[] args) {

Kind regards

Thomas Saxtoft
Gladsaxe Møllevej 28
2860 Søborg
Tlf.: 39 57 75 31 (direkte)
Fax: 39 57 75 97

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

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