[logback-user] Help with SMTPAppender configuration

Gianni gdoe6545 at yahoo.it
Fri Aug 29 22:14:38 CEST 2008


Hi
I'm unable to get the SMTPAppender working, I've got mail.jar and  
activation.jar on my classpath and I'm running an SMTP server on my  
localhost. When I generate log events of level ERROR no attempts are  
made to send messages according to my mail server logs.

I'm not sure how to go about diagnosing the problem as logback does  
not log messages about itself.
Any suggestions appreciated.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
     <appender class="ch.qos.logback.core.rolling.RollingFileAppender"
               name="FILE">
         <file>${catalina.home}/logs/myapp.log</file>
         <append>true</append>
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>debug</level>
         </filter>
         <rollingPolicy  
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
             <fileNamePattern>resprompt.%i.log.gz</fileNamePattern>
             <minIndex>1</minIndex>
             <maxIndex>3</maxIndex>
         </rollingPolicy>
         <triggeringPolicy  
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
             <maxFileSize>10MB</maxFileSize>
         </triggeringPolicy>
         <layout class="ch.qos.logback.classic.PatternLayout">
             <pattern>%-30(%d{HH:mm:ss.SSS} [%thread]) %-5level  
%logger{64} - %msg%n</pattern>
         </layout>
     </appender>

     <appender name="STDOUT"
               class="ch.qos.logback.core.ConsoleAppender">
         <layout class="ch.qos.logback.classic.PatternLayout">
             <pattern>
                 \(%d{HH:mm:ss.SSS} [%thread]\) %-5level %logger{32} -  
%msg%n
             </pattern>
         </layout>
     </appender>

     <appender  name="EMAIL"  
class="ch.qos.logback.classic.net.SMTPAppender">
         <SMTPHost>localhost</SMTPHost>
         <to>me at mydomain.com</to>
         <from>errors at myapp.com</from>
         <subject>Application error</subject>
         <layout class="ch.qos.logback.classic.PatternLayout">
             <pattern>%-30(%d{HH:mm:ss.SSS} [%thread]) %-5level  
%logger{32} - %msg%n</pattern>
         </layout>
     </appender>

     <root>
         <level value="DEBUG"/>
         <appender-ref ref="EMAIL"/>
         <appender-ref ref="FILE"/>
         <!--<appender-ref ref="STDOUT"/>-->
     </root>
</configuration>

Thanks
Gianni



More information about the Logback-user mailing list