How to enable Logger.debug() in Log4j

前端 未结 8 1926
谎友^
谎友^ 2020-12-07 18:53

While trying to execute the following lines only the last two statements are displayed(\"Here is some ERROR\" and \"Here is some FATAL\") and the first three statements are

8条回答
  •  鱼传尺愫
    2020-12-07 19:28

    This is happening due to the fact that the logging level of your logger is set to 'error' - therefore you will only see error messages or above this level in terms of severity so this is why you also see the 'fatal' message.

    If you set the logging level to 'debug' on your logger in your log4j.xml you should see all messages.

    Have a look at the log4j introduction for explaination.

提交回复
热议问题