logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian King" <isk...@ntlworld.com>
Subject SMTPAppender - empty email body
Date Mon, 20 Mar 2006 02:03:37 GMT
Hi,

 

I'm trying to use SMTPAppender to send email alerts. The emails are sent
okay but the message body is always empty. The full message body is output
to the console no problem. Does anyone know what's going on? Here is my
log4j.xml:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd">

<log4j:configuration>

    <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">

        <param name="Target" value="System.out" />

        <layout class="org.apache.log4j.PatternLayout">

            <param name="ConversionPattern"

              value="[%d{ISO8601}] %-5p %c %m %n" />

        </layout>

        <filter class="org.apache.log4j.varia.LevelRangeFilter">

            <param name="LevelMin" value="INFO"/>

            <param name="LevelMax" value="INFO"/>

        </filter>

    </appender>

    <appender name="STDERR"  class="org.apache.log4j.ConsoleAppender">

        <param name="Target" value="System.err" />

        <layout class="org.apache.log4j.PatternLayout">

            <param name="ConversionPattern"

              value="[%d{ISO8601}] %-5p %c %m %n" />

        </layout>

        <filter class="org.apache.log4j.varia.LevelRangeFilter">

            <param name="LevelMin" value="WARN"/>

            <param name="LevelMax" value="FATAL"/>

        </filter>

    </appender>

 

    <!--                          -->

    <!-- Declare the SMTPAppender -->

    <!--                          -->

    <appender name="EMAIL"  class="org.apache.log4j.net.SMTPAppender">

        <param name="BufferSize" value="512" />

        <param name="SMTPHost" value="smtp.myhost.com" />

        <param name="From" value="myemail@myhost.com" />

        <param name="To" value=" myemail@myhost.com" />

        <param name="Subject" value="[SMTPAppender] Application message" />

        <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>

 

    <!--                           -->

    <!-- setup log4j's root logger -->

    <!--                           -->

    <root>

        <level value="all" />

        <appender-ref ref="STDOUT"/>

        <appender-ref ref="STDERR"/>

        <appender-ref ref="EMAIL" />

    </root>

</log4j:configuration>

 

Many Thanks

Ian

 


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