How do I set log4j level on the command line?

后端 未结 7 939
暖寄归人
暖寄归人 2020-12-24 10:27

I want to add some log.debug statements to a class I\'m working on, and I\'d like to see that in output when running the test. I\'d like to override the log4j properties on

7条回答
  •  庸人自扰
    2020-12-24 10:55

    These answers actually dissuaded me from trying the simplest possible thing! Simply specify a threshold for an appender (say, "console") in your log4j.configuration like so:

    log4j.appender.console.threshold=${my.logging.threshold}
    

    Then, on the command line, include the system property -Dlog4j.info -Dmy.logging.threshold=INFO. I assume that any other property can be parameterized in this way, but this is the easiest way to raise or lower the logging level globally.

提交回复
热议问题