[logback-user] smtpappender broken in 1.2.9
Ceki Gülcü
ceki at qos.ch
Tue Dec 21 09:26:20 CET 2021
Hi Chris,
It looks to me that you are using 1.2.8. Please check both logback-core
and logback-classic artifacts.
Let us know if that was the case,
--
Ceki Gülcü
Please contact suppport(at)qos.ch for donations, sponsorship or support
contracts related to SLF4J or logback projects.
On 21/12/2021 01:45, Chris Cheshire wrote:
> Hi,
>
> I upgraded logback to 1.2.9 (from 1.2.3) in my webapp (running under
> tomcat) and now my SMTPAppender configuration is not working. I have
> file appenders configured too, but they are all working.
>
> Relevant config from logback.xml :
>
> <property name="SERVER_NAME" value="XXX" />
> <property name="CONTEXT_PATH" value="XXX" />
> <property name="LOG_DIR" value="${catalina.base}/logs/${CONTEXT_PATH}"
> scope="system" />
>
> <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender">
> <sessionViaJNDI>true</sessionViaJNDI>
> <jndiLocation>java:comp/env/mail/XXX</jndiLocation>
> <to>XXX</to>
> <from>XXX</from>
> <subject>XXX</subject>
> <layout class="ch.qos.logback.classic.PatternLayout">
> <pattern>%date{HH:mm:ss.SSS} [%thread] [%level] %logger#%line
> %n%n%mdc%n%message%n</pattern>
> </layout>
> <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
> <bufferSize>1</bufferSize>
> </cyclicBufferTracker>
> <includeCallerData>true</includeCallerData>
> </appender>
>
> Relevant resource definition in context.xml
> <Resource name="mail/XXX"
> auth="Container"
> type="javax.mail.Session"
> mail.transport.protocol="smtps"
> mail.smtp.starttls.enable="true"
> mail.smtp.host="XXX"
> mail.smtp.port="587" />
>
>
> Found in tomcat's default log:
>
> 23:51:33,656 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
> - About to instantiate appender of type
> [ch.qos.logback.classic.net.SMTPAppender]
> 23:51:33,669 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
> - Naming appender as [email]
> 23:51:33,711 |-INFO in ch.qos.logback.classic.net.SMTPAppender[email]
> - Looking up javax.mail.Session at JNDI location
> [java:comp/env/mail/XXX]
> 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email]
> - Failed to obtain javax.mail.Session from JNDI location
> [java:comp/env/mail/XXX]
> 23:51:33,720 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[email]
> - Failed to obtain javax.mail.Session. Cannot start.
>
>
> Nothing else was changed, I just uploaded the new jars and restarted
> tomcat and now it fails. Downgraded to 1.2.7 and SMTPAppender works
> again.
More information about the logback-user
mailing list