>问题描述

在springboot中使用logback,出现一些ERROR内容:

15:12:03,094 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:12:03,094 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
15:12:03,094 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/E:/workspace/**/target/classes/logback.xml]
15:12:03,163 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:12:03,164 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
15:12:03,173 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
15:12:03,185 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
15:12:03,235 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@13:45 - no applicable action for [springProfile], current ElementPath  is [[configuration][springProfile]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@14:65 - no applicable action for [logger], current ElementPath  is [[configuration][springProfile][logger]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@15:42 - no applicable action for [appender-ref], current ElementPath  is [[configuration][springProfile][logger][appender-ref]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@17:28 - no applicable action for [root], current ElementPath  is [[configuration][springProfile][root]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@18:42 - no applicable action for [appender-ref], current ElementPath  is [[configuration][springProfile][root][appender-ref]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:39 - no applicable action for [springProfile], current ElementPath  is [[configuration][springProfile]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:87 - no applicable action for [appender], current ElementPath  is [[configuration][springProfile][appender]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@25:82 - no applicable action for [encoder], current ElementPath  is [[configuration][springProfile][appender][encoder]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@26:26 - no applicable action for [pattern], current ElementPath  is [[configuration][springProfile][appender][encoder][pattern]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:90 - no applicable action for [TriggeringPolicy], current ElementPath  is [[configuration][springProfile][appender][TriggeringPolicy]]
15:12:03,236 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:34 - no applicable action for [fileNamePattern], current ElementPath  is [[configuration][springProfile][appender][TriggeringPolicy][fileNamePattern]]
15:12:03,237 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@34:29 - no applicable action for [maxHistory], current ElementPath  is [[configuration][springProfile][appender][TriggeringPolicy][maxHistory]]
15:12:03,237 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@39:64 - no applicable action for [logger], current ElementPath  is [[configuration][springProfile][logger]]
15:12:03,237 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@40:39 - no applicable action for [appender-ref], current ElementPath  is [[configuration][springProfile][logger][appender-ref]]
15:12:03,237 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@42:28 - no applicable action for [root], current ElementPath  is [[configuration][springProfile][root]]
15:12:03,237 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@43:39 - no applicable action for [appender-ref], current ElementPath  is [[configuration][springProfile][root][appender-ref]]

>解决方式

因为我logback的配置文件命名为logback.xml(默认的,且优先级最高的默认配置文件),且在内部配置了标签,logback.xml会在springBoot初始化完成前就已生效,导致加载logback是无法识别标签出现ERROR信息。
这里将logback.xml重命名为logback-spring.xml即可。

>官方文档相关描述

大概意思还是和上面说的差不多:
如果命名为logback-spring.xml,可以使用springBoot对logback支持的诸多拓展。
之所以让命名为logback-spring.xml才可以使用springBoot支持的拓展,是因为标准logback.xml文件配置文件加载太早,解析是无法识别springboot的拓展内容。
不能启用logback自动扫描的配置去查询配置文件中的更改,否则将会出现一些问题(这就是直白的说不能直接用logback的逻辑去扫描配置了吧,否则将会出现错误):

ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:71 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:71 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]

>两个文件和资源文件加载顺序

logback.xml—>application.properties —>logback-spring.xml.

  • 注:个人博客所有内容皆为工作中遇到的问题,并不代表所有情况
  • 转载请注明出处

logback ERROR *.Interpreter@* - no applicable action for [*], current ElementPath is [*]相关推荐

  1. Logback新版本报no applicable action for [Encoding]问题

    logback.xml配置文件如下: <?xml version="1.0" encoding="UTF-8"?><configuration ...

  2. no applicable action for [triggerPolicy], current ElementPath

    配置日志的时候报错 刚开始一直找不到原因,后来百度了好久才看到一个博主有过类似的问题,抓住报错的关键词 到配置行去找到他 看看是不是单词写的不对! 因为: 项目启动后,logback会寻找符合要求的x ...

  3. no applicable action for [springProperty] logback异常

    logback错误日志 no applicable action for [springProperty], current ElementPath is [[configuration][sprin ...

  4. logback配置文件报错:no applicable action for [MaxFileSize], current ElementPath ...

    logback是SpringBoot开发过程中常用的日志工具,在使用前需要设置配置参数,一般写在logback-spring.xml文件中. 问题现象: 配置完logback-spring.xml文件 ...

  5. no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]

    今天down了一个开源项目,启动后一直存在如下错误信息: ERROR in ch.qos.logback.core.joran.spi.Interpreter@26:42 - no applicabl ...

  6. elk日志启动异常:no applicable action for springProfile

    现象 项目中加入logback-kafka-appender和logstash-logback-encoder的elk日志,启动时日志中出现下列错误 15:56:36,022 |-ERROR in c ...

  7. java error could_Java.lang.Error: Properties init: Could not determine current working directory.

    用shell脚本编译项目,重新发布后,启动tomcat出现错误: Error occurred during initialization of VM java.lang.Error: Propert ...

  8. Windows CE.0002.ERROR:Image is too large for current RAM and RAMIMAGE settings.

    在编译WinCE项目时,遇到ERROR:Image is too large for current RAM and RAMIMAGE settings.时,请将 下图所示选项选中,即可解决. 转载于 ...

  9. flutter项目报错:Error: Entrypoint isn‘t within the current project

    Error: Entrypoint isn't within the current project 网上看到很多中解决办法,但是我都试了都不行:然后换了一种搜索方式搜到一篇文章 大概是我不小心把li ...

最新文章

  1. why my custom callback is not called
  2. mysql两台服务器怎么做数据同步_两台mysql服务器实现双机互备配置并测试数据同步...
  3. AUTOSAR从入门到精通100讲(三十八)-通信网络中的⽐特和帧同步技术
  4. Leetcode 219. 存在重复元素 II
  5. LeetCode 808. 分汤(动态规划)
  6. 唯一《可解释机器学习》中文书来了:复旦研究生翻译,原作者转发点赞
  7. devops的重要性_为什么反馈而不是指标对DevOps至关重要
  8. PHP-线程安全与非线程安全版本的区别
  9. Haproxy+Keepalived+Nginx
  10. 一个支持CGI的极简WebServer
  11. Python数据挖掘——概况
  12. 电脑系统win11改win10怎么改?Win11改win10教程
  13. VMware Tools安装教程
  14. BitLocker驱动器
  15. 倾斜摄影超大场景的三维模型的顶层合并的优势浅析
  16. 数据库大数据量、高并发、高可用解决方案!
  17. java计算机毕业设计流行病调查平台源码+数据库+系统+lw文档+mybatis+运行部署
  18. 基于matlab的电机,基于MATLAB的电机仿真研究
  19. 浅析STM32H7 FDCAN(一)
  20. Python图像处理(车牌识别)简单

热门文章

  1. 计算机应用基础大作业0483,西南大学2020年春季计算机应用基础【0483】课程考试大作业参考答案.pdf...
  2. Java学习---第二周周报
  3. OpenSSL 生成证书
  4. 最常用的酒店IPTV系统实施方案
  5. python plc_基于python的西门子plc数据采集系统
  6. PHP与MySQL外文文献译文和原文_PHP外文翻译文献-php网上书城系统外文翻译
  7. STM32F4实现SD卡读写
  8. 那些优秀的程序员都在看哪些书?
  9. Excel todolist制作
  10. 小白轻松10分钟搞定Ubuntu常用命令(史上最全)