logback.xml 使用condition时,自身调试信息无法关闭
<configuration debug="false"> 可以关闭启动时,logback自身的调试输出如
23:39:12,858 |-INFO in ch.qos.logback.classic.LoggerContext[cpic_web] - Could NOT find resource [logback.groovy]
23:39:12,858 |-INFO in ch.qos.logback.classic.LoggerContext[cpic_web] - Could NOT find resource [logback-test.xml]
23:39:12,858 |-INFO in ch.qos.logback.classic.LoggerContext[cpic_web] - Found resource [logback.xml] at [file:/F:/git/sxtbweb/cpic-web/target/classes/logback.xml]
23:39:13,016 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [cpic_web]
23:39:13,016 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
23:39:13,020 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
23:39:13,043 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
23:39:13,102 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Could not find Janino library on the class path. Skipping conditional processing.
23:39:13,103 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
23:39:13,103 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
23:39:13,103 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
23:39:13,105 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7c504887 - Registering current configuration as safe fallback point
但一旦使用condition,xml就被认为是格式不良好的了?
<if condition='property("HOSTNAME").contains("xxxx")'>
<then>
<appender name="CON" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<root>
<appender-ref ref="CON" />
</root>
</then>
</if>
启动时会有自身调试日志和以下这句
23:39:13,013 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
http://logback.qos.ch/manual/configuration.html
官方提到
Setting the debug
attribute within the <configuration> element will output status information, assuming that:
- the configuration file is found
- the configuration file is well-formed XML.
需要 XML 格式良好
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
日志里都是 INFO 的信息,没有出错哦,连警告都不算:)