0

For some reason my log4j2 won't write anything lower than error on the screen. I have very basic code:

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class TestEN
{
    static Logger logger = LogManager.getLogger(TestEN.class);
    public static void main(String[] args)
    {
        logger.fatal("Test");
        logger.warn("Test");
    }
}

This only outputs:

16:31:59.883 [main] FATAL TestEN - Test

I don't have a log4j2.xml file set up for this project. I'm so confused... Any help would be great.

4

1 回答 1

3

您是否阅读了有关自动配置的手册

引用:

6. 如果找不到配置文件,将使用 DefaultConfiguration。这将导致日志输出转到控制台。

并且DefaultConfiguration显示默认日志级别为“错误”

于 2013-08-08T20:42:16.553 回答