How do I configure logback not to log messages from loggers in package org.package and it's subpackages unless their level is WARN or ERROR?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
And why isn't the following configuration not working for you?
<configuration>
<logger name="org.package" level="WARN"/>
<root level="ALL">
<appender class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{ISO8601} | %-5level | %thread | %logger{1} | %m%n</pattern>
</encoder>
</appender>
</root>
</configuration>
回答2:
log.getLoggerContext().getLogger("package.name").setLevel(Level.WARN);