作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 spring-boot 应用程序中有以下 logback.xml
:
<?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>admin@gmail.com</to>
<from>dev@gmail.com</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>
上下文未出现错误:
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.
...
我做错了什么?
最佳答案
compile ('javax.activation:activation:1.1.1')
compile ('javax.mail:mail:1.4.7')
依赖关系帮助了我
关于java - ch.qos.logback.core.util.DynamicClassLoadingException : Failed to instantiate type ch. qos.logback.classic.net.SMTPAppender,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46407195/
我的 spring-boot 应用程序中有以下 logback.xml: ... ...
我是一名优秀的程序员,十分优秀!