[logback-user] Issues configuring GMail appender

ceki ceki at qos.ch
Wed Jan 4 15:55:24 CET 2012


Hello Greg,

Add the following line to your logback.xml config file to see the error
message output when SMTPAppender sends out a message.

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

For more info on  OnConsoleStatusListener see [1].

By the way, you should not declare logback-access as a dependency if you 
are not using logback-access.

HTH,
--
Ceki

[1] http://logback.qos.ch/manual/configuration.html#statusListener

On 03.01.2012 20:26, Greg Silin wrote:
> Hi,
>
> I'm trying to setup logback for a fairly simple appender configuration..
>
> DEBUG, INFO, WARN: System.out Console Appender, File Appender
> ERROR: System.err Console Appender, File Appender, SMTPAppender
> configured for GMail.
>
> Following instructions to setup GMail appender, I have the following:
>
> Appender config:
>
> <!-- Email appender -->
> <appender name="MailAppender"
> class="ch.qos.logback.classic.net.SMTPAppender">
> <smtpHost>smtp.gmail.com <http://smtp.gmail.com></smtpHost>
> <smtpPort>465</smtpPort>
> <ssl>true</ssl>
> <username>MyUsername</username>
> <password>MyPassword</password>
>
> <to>greg at klout.com <mailto:greg at klout.com></to>
> <!--<to>ANOTHER_EMAIL_DESTINATION</to> <!– additional
> destinations are possible –>-->
> <from>noreply at gmail.com <mailto:noreply at gmail.com></from>
> <subject>LOGGED ERROR: %logger{20} - %m</subject>
> <layout class="ch.qos.logback.classic.PatternLayout">
> <pattern>%date %-5level %logger{35} - %message%n%xEx{35}</pattern>
> </layout>
> </appender>
>
> Appender inclusion:
>
> <root level="ERROR">
> <appender-ref ref="StdErrAppender" />
> <appender-ref ref="FileAppender" />
> <appender-ref ref="MailAppender" />
> </root>
>
> All appropriate maven dependencies:
>
> logger jars
>
> <slf4j.version>1.6.4</slf4j.version>
>
> <dependency>
> <groupId>org.slf4j</groupId>
> <artifactId>slf4j-api</artifactId>
> <version>${slf4j.version}</version>
> </dependency>
> <dependency>
> <groupId>ch.qos.logback</groupId>
> <artifactId>logback-access</artifactId>
> <version>1.0.0</version>
> </dependency>
> <dependency>
> <groupId>ch.qos.logback</groupId>
> <artifactId>logback-classic</artifactId>
> <version>1.0.0</version>
> </dependency>
> <dependency>
> <groupId>ch.qos.logback</groupId>
> <artifactId>logback-core</artifactId>
> <version>1.0.0</version>
> </dependency>
>
>
> java mail
> <dependency>
> <groupId>javax.mail</groupId>
> <artifactId>mail</artifactId>
> <version>1.4.4</version>
> </dependency>
>
>
> All the other appenders work just fine as configured. I see that the
> SMTPAppender is being loaded w/o error (at least nothing I see reported)
> .. yet on ERROR nothing gets sent.  Username & password are all correct.
>   I've confirmed with our operations that we don't have any special spam
> filters set up.
>
> Thoughts on what could be wrong / what I need to check?
>
> Thanks
> -greg
>
>



More information about the Logback-user mailing list