logback在SpringBoot下出现no applicable action for [appender], current ElementPath is [[configuration][a(

临文乍了了,彻卷兀若无。这篇文章主要讲述logback在SpringBoot下出现no applicable action for [appender], current ElementPath is [[configuration][a(相关的知识,希望能为你提供帮助。
可能因为最新版的不支持一些日志级别
注意看注释的地方

  1. < ?xml version="1.0" encoding="UTF-8"?>
  2. < configuration debug="true">
  3. < !--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
  4. < property name="LOG_HOME" value="d:/log" />
  5. < !-- 控制台输出 -->
  6. < appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  7. < encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  8. < !--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  9. < pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n< /pattern>
  10. < /encoder>
  11. < /appender>
  12. < !-- 按照每天生成日志文件 -->
  13. < appender name="FILE"class="ch.qos.logback.core.rolling.RollingFileAppender">
  14. < rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  15. < !--日志文件输出的文件名-->
  16. < FileNamePattern> ${LOG_HOME}/TestWeb.log.%d{yyyy-MM-dd-HH-mm}.log< /FileNamePattern>
  17. < !--日志文件保留天数-->
  18. < MaxHistory> 30< /MaxHistory>
  19. < /rollingPolicy>
  20. < encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  21. < !--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  22. < pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n< /pattern>
  23. < /encoder>
  24. < !--日志文件最大的大小-->
  25. < triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  26. < MaxFileSize> 10MB< /MaxFileSize>
  27. < /triggeringPolicy>
  28. < /appender>
  29. < !-- info -->
  30. < !-- Info -->
  31. < appender name="info1" class="ch.qos.logback.core.rolling.RollingFileAppender">
  32. < !--< appender> true< /appender> -->
  33. < filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  34. < level> INFO< /level>
  35. < /filter>
  36. < !-- 每天生成日志文件 -->
  37. < rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  38. < fileNamePattern> ${LOG_HOME}/info.%d{yyyy-MM-dd}.log
  39. < /fileNamePattern>
  40. < !-- 日志文件保留15天 -->
  41. < maxHistory> 15< /maxHistory>
  42. < /rollingPolicy>
  43. < !-- 格式化输出 -->
  44. < encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  45. < pattern> %date{yyyy-MM-dd HH:mm:ss.SSS} | %thread | %-5level | %class{20}:%file(%line) | %msg%n< /pattern>
  46. < /encoder>
  47. < /appender>
  48. < !--debug-->
  49. < appender name="debug1" class="ch.qos.logback.core.rolling.RollingFileAppender">
  50. < !-- < appender> true< /appender> -->
  51. < filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  52. < level> debug< /level>
  53. < !--< onMatch> ACCEPT< /onMatch>
  54. < onMismatch> DENY< /onMismatch> -->
  55. < /filter>
  56. < !-- 每天生成日志文件 -->
  57. < rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  58. < fileNamePattern> ${LOG_HOME}/debug.%d{yyyy-MM-dd}.log
  59. < /fileNamePattern>
  60. < !-- 日志文件保留15天 -->
  61. < maxHistory> 15< /maxHistory>
  62. < /rollingPolicy>
  63. < !-- 格式化输出 -->
  64. < encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  65. < pattern> %date{yyyy-MM-dd HH:mm:ss.SSS} | %thread | %-5level | %class{20}:%file(%line) | %msg%n< /pattern>
  66. < /encoder>
  67. < /appender>
  68. < !--< appender name="info_async" class="ch.qos.logback.classic.AsyncAppender">
  69. < discardingThreshold> 3000< /discardingThreshold>
  70. < queueSize> 10000< /queueSize>
  71. < appender-ref ref="info" />
  72. < /appender> -->
  73. < !-- show parameters for hibernate sql 专为 Hibernate 定制 -->
  74. < logger name="org.hibernate.type.descriptor.sql.BasicBinder"level="TRACE" />
  75. < logger name="org.hibernate.type.descriptor.sql.BasicExtractor"level="DEBUG" />
  76. < logger name="org.hibernate.SQL" level="DEBUG" />
  77. < logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
  78. < logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
  79. < !--myibatis log configure-->
  80. < logger name="com.apache.ibatis" level="TRACE"/>
  81. < logger name="java.sql.Connection" level="DEBUG"/>
  82. < logger name="java.sql.Statement" level="DEBUG"/>
  83. < logger name="java.sql.PreparedStatement" level="DEBUG"/>
  84. < !-- 日志输出级别 -->
  85. < root level="INFO">
  86. < appender-ref ref="STDOUT" />
  87. < appender-ref ref="FILE" />
  88. < appender-ref ref="info1" />
  89. < appender-ref ref="debug1" />
  90. < /root>
  91. < !--日志异步到数据库 -->
  92. < !--< appender name="DB" class="ch.qos.logback.classic.db.DBAppender"> -->
  93. < !--& lt; !& ndash; 日志异步到数据库 & ndash; & gt; -->
  94. < !--< connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource"> -->
  95. < !--& lt; !& ndash; 连接池 & ndash; & gt; -->
  96. < !--< dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource"> -->
  97. < !--< driverClass> com.mysql.jdbc.Driver< /driverClass> -->
  98. < !--< url> jdbc:mysql://127.0.0.1:3306/databaseName< /url> -->
  99. < !--< user> root< /user> -->
  100. < !--< password> root< /password> -->
  101. < !--< /dataSource> -->
  102. < !--< /connectionSource> -->
  103. < !--< /appender> -->
  104. < /configuration>

【logback在SpringBoot下出现no applicable action for [appender], current ElementPath is [[configuration][a(】原文地址:https://blog.csdn.net/bestxianfeng163/article/details/83616492

    推荐阅读