logback在SpringBoot下出现no applicable action for [appender], current ElementPath is [[configuration][a(
Posted 星朝
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了logback在SpringBoot下出现no applicable action for [appender], current ElementPath is [[configuration][a(相关的知识,希望对你有一定的参考价值。
可能因为最新版的不支持一些日志级别
注意看注释的地方
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration debug="true">
- <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
- <property name="LOG_HOME" value="d:/log" />
- <!-- 控制台输出 -->
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
- </encoder>
- </appender>
- <!-- 按照每天生成日志文件 -->
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <!--日志文件输出的文件名-->
- <FileNamePattern>${LOG_HOME}/TestWeb.log.%d{yyyy-MM-dd-HH-mm}.log</FileNamePattern>
- <!--日志文件保留天数-->
- <MaxHistory>30</MaxHistory>
- </rollingPolicy>
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
- </encoder>
- <!--日志文件最大的大小-->
- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <MaxFileSize>10MB</MaxFileSize>
- </triggeringPolicy>
- </appender>
- <!-- info -->
- <!-- Info -->
- <appender name="info1" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <!-- <appender>true</appender> -->
-
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <!-- 每天生成日志文件 -->
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_HOME}/info.%d{yyyy-MM-dd}.log
- </fileNamePattern>
- <!-- 日志文件保留15天 -->
- <maxHistory>15</maxHistory>
- </rollingPolicy>
- <!-- 格式化输出 -->
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} | %thread | %-5level | %class{20}:%file(%line) | %msg%n</pattern>
- </encoder>
- </appender>
- <!--debug -->
- <appender name="debug1" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <!-- <appender>true</appender> -->
-
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>debug</level>
- <!-- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch> -->
- </filter>
- <!-- 每天生成日志文件 -->
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_HOME}/debug.%d{yyyy-MM-dd}.log
- </fileNamePattern>
- <!-- 日志文件保留15天 -->
- <maxHistory>15</maxHistory>
- </rollingPolicy>
- <!-- 格式化输出 -->
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} | %thread | %-5level | %class{20}:%file(%line) | %msg%n</pattern>
- </encoder>
- </appender>
- <!-- <appender name="info_async" class="ch.qos.logback.classic.AsyncAppender">
- <discardingThreshold>3000</discardingThreshold>
- <queueSize>10000</queueSize>
- <appender-ref ref="info" />
- </appender> -->
-
- <!-- show parameters for hibernate sql 专为 Hibernate 定制 -->
- <logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
- <logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
- <logger name="org.hibernate.SQL" level="DEBUG" />
- <logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
- <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-
- <!--myibatis log configure-->
- <logger name="com.apache.ibatis" level="TRACE"/>
- <logger name="java.sql.Connection" level="DEBUG"/>
- <logger name="java.sql.Statement" level="DEBUG"/>
- <logger name="java.sql.PreparedStatement" level="DEBUG"/>
-
- <!-- 日志输出级别 -->
- <root level="INFO">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- <appender-ref ref="info1" />
- <appender-ref ref="debug1" />
- </root>
- <!--日志异步到数据库 -->
- <!--<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">-->
- <!--<!–日志异步到数据库 –>-->
- <!--<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">-->
- <!--<!–连接池 –>-->
- <!--<dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">-->
- <!--<driverClass>com.mysql.jdbc.Driver</driverClass>-->
- <!--<url>jdbc:mysql://127.0.0.1:3306/databaseName</url>-->
- <!--<user>root</user>-->
- <!--<password>root</password>-->
- <!--</dataSource>-->
- <!--</connectionSource>-->
- <!--</appender>-->
- </configuration>
原文地址:https://blog.csdn.net/bestxianfeng163/article/details/83616492
以上是关于logback在SpringBoot下出现no applicable action for [appender], current ElementPath is [[configuration][a(的主要内容,如果未能解决你的问题,请参考以下文章
在带有 logback 配置的 Ubuntu 上部署 SpringBoot 失败并出现 FileNotFoundException (Permission Denied)