logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Cheshire" <cheshira...@gmail.com>
Subject smtpappender not working in jboss
Date Thu, 15 Jun 2006 18:20:45 GMT
I have configured log4j to write app logs using the RepositorySelector
found in the JBoss Wiki, and it is working just fine. I have tried to
add an email appender to the configuration to email me the error &
fatal messages and they are not getting sent. The log file contains
the errors, but no email is ever generated (I checked the mail server
logs, and nothing is ever being received).

The config is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
    <appender name="dailyLogFile"
class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="${log4j.log.dir}/myapp.log"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p [%c{1}] - %m%n"/>
        </layout>
    </appender>

    <appender name="email" class="org.apache.log4j.net.SMTPAppender">
        <param name="From" value="someemailaddress" />
        <param name="To" value="myemailaddress" />
        <param name="SMTPHost" value="mymailhost" />
        <param name="Subject" value="webapp error" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
value="[%d]%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>

    <category name="mycategoryname">
        <priority value="DEBUG"/>
        <appender-ref ref="dailyLogFile"/>
        <appender-ref ref="email" />
    </category>

    <category name="anothercategoryname">
        <priority value="DEBUG" />
        <appender-ref ref="dailyLogFile" />
    </category>

    <root>
        <priority value="WARN"/>
        <appender-ref ref="STDOUT"/>
    </root>
</log4j:configuration>

I just wrote a very simple java app (not web app) that uses the same
config and writes an error and fatal log, and they both get mailed
fine, so it appears the configuration is ok.

I have posted this on JBoss forums but have had no luck there. Can
anyone offer me some help here?

Thanks,

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message