log4j SMTPAppender not sending mail

Discussion in 'Java' started by aflat362, Nov 1, 2006.

  1. aflat362

    aflat362 Guest

    I have a log4j SMTPAppender set up in my XML config file.

    Everything seems valid yet I don't receive any email messages.

    I had our exchange server admin perform a trace on the SMTP server and
    it doesn't even seem like I am hitting the SMTP server at all.

    I'm using eclipse 3.2 and log4j 1.2.14

    I have mail.jar, mailapi.jar and activation.jar in my project build
    path.

    Here is my log4j XML config file (sensitive information censored out):

    Also - my program is in fact logging error statements but I don't get
    the email when an error occurs.


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <appender name="fileappender" class="org.apache.log4j.FileAppender">
    <param name="File" value="IppsLdapSynch.log.txt"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
    </layout>
    </appender>

    <appender name="consoleappender"
    class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d %p - %m%n"/>
    </layout>
    </appender>

    <appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
    <param name="BufferSize" value="512" />
    <param name="SMTPHost" value="xxxxxxxxxxxxx" />
    <param name="From" value="xxxxxxxxxxxxx" />
    <param name="To" value="xxxxxxxxxxxxxxx" />
    <param name="Subject" value="An Error has occurred in
    IppsLdapSynch" />
    <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>

    <root>
    <priority value ="info"/>
    <appender-ref ref="EMAIL"/>
    <appender-ref ref="fileappender"/>
    <appender-ref ref="consoleappender"/>
    </root>

    </log4j:configuration>
     
    aflat362, Nov 1, 2006
    #1
    1. Advertising

  2. aflat362

    aflat362 Guest

    Just some more info on this.

    I created an executable jar of my program and ran it outside of
    eclipse. There is no problem sending email outside of eclipse - it
    only doesn't send mail when I run inside of eclipse.

    Also to note, I've used SMTPAppender in other programs I wrote using
    IBM WebSphere 5.1.2 and there's no problem sending email from within
    there.
     
    aflat362, Nov 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,781
    Alexandra Stehman
    Jan 19, 2004
  2. Alex Hunsley
    Replies:
    2
    Views:
    12,944
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  3. Replies:
    0
    Views:
    2,148
  4. Replies:
    0
    Views:
    1,375
  5. Mikhail Teterin
    Replies:
    0
    Views:
    887
    Mikhail Teterin
    Feb 20, 2008
Loading...

Share This Page