I've configured Tomcat to use SLF4J/logback for all logging. I've set up an SMTPAppender in server/lib/logback.xml. It is sending an email per error and all seems fine. But when I shut down Tomcat, I get the following error:
13:44:14,431 |-INFO in ch.qos.logback.classic.net.SMTPAppender[ERROR_EMAIL] - About to send out SMTP message "ERROR: o.a.c.l.WebappClassLoader - The web application [] appears to have started a thread named [logback-1] but has failed to stop it. This is very likely to create a memory leak."
13:44:14,446 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[ERROR_EMAIL] - Error occurred while sending e-mail notification. javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_2_1458580013.1444423454431"
at javax.mail.MessagingException: IOException while sending message
at at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1177)
at at javax.mail.Transport.send0(Transport.java:195)
at at javax.mail.Transport.send(Transport.java:124)
at at ch.qos.logback.core.net.SMTPAppenderBase.sendBuffer(SMTPAppenderBase.java:394)
The config looks like this:
<appender name="ERROR_EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<!-- guarantees that only logs of ERROR will be emailed -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<asynchronousSending>true</asynchronousSending>
<includeCallerData>true</includeCallerData>
<smtpHost>xyz.company.com</smtpHost>
<smtpPort>25</smtpPort>
<STARTTLS>false</STARTTLS>
<to>me@company.com</to>
<from>administrator@company.com</from>
<subject>ERROR: %logger{20} - %m</subject>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%date %-5level %logger{35} - %message%n</pattern>
</layout>
</appender>
All of the emails were actually sent minutes before shutting down. The error message only shows up when I shut the server down. I've tried mail.jar (version 1.4.5) and javax.mail-1.5.4.jar.
I'm running Tomcat 7 with Java 7 JDK, on Windows 7 as a service. I'm using SLF4J 1.7.12 and logback 1.1.3. There is only one web app and it does not have a mail jar in it (I put a mail.jar file in the web apps lib folder to test for class loader issues but then the error emails don't have a body)
I've tried and failed to figure out why it has the mime error in the first place. I tried adding activation.jar version 1.1, but it did not help.
Now as I'm posting this, and anticipating some flaming, I'm thinking that I should create a very simple web app that just logs an error and eliminate any web-inf/lib jar conflicts that might be going on. Also, I need to see if there is some way to cause the appender to flush after sending and try not sending ni asynch mode. But I appreciate any help in the meantime.