[logback-user] SMTPAppender problem using gmail example

Federico Schroder fschroder at gmail.com
Wed Mar 10 14:34:51 CET 2010


I switched to the latest version of logback and everything is working now.

I have a minor issue now. The project uses the classes from a previous
(rather old) thread which, notably
it.stratosfera.commons.logback.LogbackConfigurer which invokes
context.shutdownAndReset() a number of times. I see that that method is no
longer available in the API. Is there a replacement or is the shutdown no
longer needed?

Thanks for your help,
Federico

On Wed, Mar 10, 2010 at 9:23 AM, Federico Schroder <fschroder at gmail.com>wrote:

> I have the following files in the classpath:
>
> logback-classic-0.9.9.jar
> logback-core-0.9.9.jar
> jcl-over-slf4j-1.5.10.jar
> log4j-over-slf4j-1.5.10.jar
> slf4j-api-1.5.10.jar
>
> and
> javamail-1.4.3.jar
> activation-jaf-1.1.1.jar
>
> Here is the whole file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration debug="true">
>     <appender name="mainFile"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>         <File>${webapp.root}/WEB-INF/semplest-main.log</File>
>         <rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>
> <FileNamePattern>${webapp.root}/WEB-INF/semplest-main.%d{yyyy-MM-dd}.log</FileNamePattern>
>           <!-- keep 90 days' worth of history -->
>           <MaxHistory>90</MaxHistory>
>         </rollingPolicy>
>         <layout class="ch.qos.logback.classic.PatternLayout">
>             <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} -
> %msg%n</pattern>
>         </layout>
>     </appender>
>
>     <appender name="errorFile"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>         <File>${webapp.root}/WEB-INF/semplest-error.log</File>
>         <rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>
> <FileNamePattern>${webapp.root}/WEB-INF/semplest-error.%d{yyyy-MM-dd}.log</FileNamePattern>
>           <!-- keep 90 days' worth of history -->
>           <MaxHistory>90</MaxHistory>
>         </rollingPolicy>
>         <!-- deny all events with a level below ERROR -->
>         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>           <level>ERROR</level>
>         </filter>
>         <layout class="ch.qos.logback.classic.PatternLayout">
>           <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} -
> %msg%n</pattern>
>         </layout>
>       </appender>
>
> <!--  NOT WORKING -->
>     <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender">
>         <SMTPHost>smtp.gmail.com</SMTPHost>
>         <SMTPPort>465</SMTPPort>
>         <SSL>true</SSL>
>         <Username>yyy at gmail.com</Username>
>         <Password>xxx</Password>
>         <To>zzz at gmail.com</To>
>         <From>aaa at no-reply.com</From>
>         <Subject>SEMPLEST ERROR: %class{20} - %m</Subject>
>         <!-- deny all events with a level below ERROR -->
>         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>           <level>ERROR</level>
>         </filter>
>         <layout class="ch.qos.logback.classic.PatternLayout">
>           <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} -
> %msg%n</pattern>
>         </layout>
>     </appender>
> <!-- -->
>
>     <logger name="com.semplest">
>         <level value="INFO" />
>     </logger>
>
>     <root>
>         <level value="WARN" />
>         <appender-ref ref="mainFile" />
>         <appender-ref ref="errorFile" />
>         <appender-ref ref="email" />
>     </root>
> </configuration>
>
> Thanks,
> Federico
>
> On Wed, Mar 10, 2010 at 4:41 AM, Ceki Gülcü <ceki at qos.ch> wrote:
>
>>
>> The config file snippet looks good. I really don't see how the error you
>> are seeing could occur. Which version of logback are you using?
>>
>> You could you also provide the whole config file?
>>
>>
>> On 10/03/2010 12:56 AM, Federico Schroder wrote:
>>
>>> Hello, I'm having problems trying to use the gmail example provided
>>> here: http://logback.qos.ch/manual/appenders.html
>>>
>>> My config is:
>>>
>>> ...
>>> <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender">
>>> <SMTPHost>http://smtp.gmail.com</SMTPHost>
>>>
>>> <SMTPPort>465</SMTPPort>
>>> <SSL>true</SSL>
>>> <Username>yyy at gmail.com</Username>
>>> <Password>xxx</Password>
>>> <To>zzz at gmail.com <mailto:zzz at gmail.com></To>
>>> <From>aaa at no-reply.com <mailto:aaa at no-reply.com></From>
>>>
>>> <Subject>APP ERROR: %class{20} - %m</Subject>
>>> <!-- deny all events with a level below ERROR -->
>>> <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>>> <level>ERROR</level>
>>> </filter>
>>> <layout class="ch.qos.logback.classic.PatternLayout">
>>> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} -
>>> %msg%n</pattern>
>>> </layout>
>>> </appender>
>>> ...
>>>
>>> ... and I'm getting this in the log:
>>>
>>> 19:41:03,031 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 38:16
>>> - no applicable action for [SMTPPort], current pattern is
>>> [[configuration][appender][SMTPPort]]
>>> 19:45:30,244 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 39:11
>>> - no applicable action for [SSL], current pattern is
>>> [[configuration][appender][SSL]]
>>> 19:45:40,367 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 40:16
>>> - no applicable action for [Username], current pattern is
>>> [[configuration][appender][Username]]
>>> 19:45:40,740 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 41:16
>>> - no applicable action for [Password], current pattern is
>>> [[configuration][appender][Password]]
>>>
>>>
>>> Any suggestion on what could be wrong?
>>> Thanks,
>>> Federico
>>>
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://qos.ch/mailman/listinfo/logback-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20100310/4d742716/attachment.html>


More information about the Logback-user mailing list