[logback-user] SMTP Appender silently fails

ceki ceki at qos.ch
Mon Mar 5 18:58:19 CET 2012


Hi Alex,

I am investigating this issue. In the mean time, please add an 
OnConsoleStatusListener to the top of your config file.

<configuration>
   <statusListener
          class="ch.qos.logback.core.status.OnConsoleStatusListener" />
   ....
</configuration>

This will print error messages occurring after configuration.

-- 
Ceki
http://twitter.com/#!/ceki


On 02.03.2012 18:46, Alex Glass wrote:
> I'm trying to use SMTPAppender to send a log message through gmail.  I
> have added javax.mail:mailapi:1.4.3 as a depdendency.  I also tried
> adding javax.activation:activation:1.1.1 with no success.  If I change
> the host to xyz, it has no affect.  This is my configuration file:
>
> <configuration debug="true">
> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
> <encoder>
> <pattern>
>                  %-4relative [out] %-5level %logger - %msg%n
> </pattern>
> </encoder>
> </appender>
>
> <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
> <smtpHost>smtp.gmail.com <http://smtp.gmail.com></smtpHost>
> <smtpPort>465</smtpPort>
> <SSL>true</SSL>
> <username>somebody at gmail.com <mailto:somebody at gmail.com></username>
> <password>somepass</password>
> <to>someone at gmail.com <mailto:someone at gmail.com></to>
> <from>somebody at gmail.com <mailto:somebody at gmail.com></from>
> <subject>Testing %logger{20} - %m</subject>
>
> <layout class="ch.qos.logback.classic.PatternLayout">
> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n</pattern>
> </layout>
> </appender>
>
> <root level="info">
> <appender-ref ref="STDOUT" />
> <appender-ref ref="EMAIL" />
> </root>
> </configuration>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Console output
>
> 12:45:56,627 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
> 12:45:56,630 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> Naming appender as [STDOUT]
> 12:45:56,644 |-INFO in
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming
> default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for
> [encoder] property
> 12:45:56,668 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> About to instantiate appender of type
> [ch.qos.logback.classic.net.SMTPAppender]
> 12:45:56,678 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> Naming appender as [EMAIL]
> 12:45:56,714 |-INFO in
> ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of
> ROOT logger to INFO
> 12:45:56,714 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [STDOUT] to Logger[ROOT]
> 12:45:56,715 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [EMAIL] to Logger[ROOT]
> 12:45:56,715 |-INFO in
> ch.qos.logback.classic.joran.action.ConfigurationAction - End of
> configuration.
>
> 180  [out] INFO  SmtpTest - Hello World
>
>


More information about the Logback-user mailing list