问题与分析 在使用Log4j2时,虽然可以正确读取配置文件并生成log文件,但偶然发现控制台打印了异常信息如下: 2018-12-31 17:28:14,282 Log4j2-TF-19-ConfiguratonFileWatcher-6 ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile:
root cause java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerWrapper 网上资料比较少,最后查到是mybatis 3.2.7的bug,升级到3.3.0就好了 详见:https://github.com/mybatis/mybatis-3/issues/234 emacarron modified the milestone: 3.2.8, 3.3.0 on 10 Oct 2014
log4j定义了8个级别的log(除去OFF和ALL,可以说分为6个级别),优先级从高到低依次为:OFF.FATAL.ERROR.WARN.INFO.DEBUG.TRACE. ALL. 1. ALL 最低等级的,用于打开所有日志记录. 2. TRACE designates finer-grained informational events than the DEBUG.Since:1.2.12,很低的日志级别,一般不会使用. 3. DEBUG 指出细粒度信息事件对调试应用程序是非常有帮助的,