I have the following logback.xml
in my spring-boot application:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
...
</appender>
<timestamp key="datetime" datePattern="yy-MM-dd-HH-mm-ss" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
...
</appender>
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<smtpHost>smtp.gmail.com</smtpHost>
<smtpPort>587</smtpPort>
<STARTTLS>true</STARTTLS>
<username></username>
<password></password>
<to>[email protected]</to>
<from>[email protected]</from>
<subject>Error</subject>
<layout class="ch.qos.logback.classic.html.HTMLLayout"/>
<asynchronousSending>true</asynchronousSending>
<encoder>
<pattern>
%d{dd.MM.yy HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="EMAIL" />
</root>
</configuration>
Context is not up with error:
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [ch.qos.logback.classic.net.SMTPAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:73 - ActionException in Action for tag [appender] ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.classic.net.SMTPAppender
ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [EMAIL]. Did you define it below instead of above in the configuration file?
ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.
...
What do I wrong?
compile ('javax.activation:activation:1.1.1')
compile ('javax.mail:mail:1.4.7')
dependencies helped me