[英]No console output using log4j2 and slf4j
am I missing something using this configuration? 我是否缺少使用此配置的某些内容? I thought that root logger would log all events from error level to the bottom one.
我以为root记录器会将所有事件从错误级别记录到最底层。 If I try to log event at info level, there is no output.
如果我尝试在信息级别记录事件,则没有输出。 This config gives me only error leveled logs.
此配置仅给我提供错误级别的日志。 I am using slf4j to create logger objects through Logger-factory class.
我正在使用slf4j通过Logger-factory类创建记录器对象。
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
For info level logs, change the configuration, in particular Root level to info as show below 对于信息级别的日志,将配置(特别是根级别)更改为info,如下所示
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
By changing level to info, the program will start logging both info, error logs in the console. 通过将级别更改为info,程序将开始在控制台中同时记录info和error日志。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.