How do I adjust log4j levels at runtime?

后端 未结 2 1518
你的背包
你的背包 2021-02-19 07:19

I have a simple web app running on Tomcat 5.5 with log4j for logging. Occasionally I need to push the logging down to DEBUG but most of the time I\'m happy with INFO.

I

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 08:03

    Just use the programmatic API:

    logger.setLevel(Level.DEBUG)
    

    in your program when you need more verbose logging output, and

    logger.setLevel(Level.INFO)
    

    to make it less verbose again.

提交回复
热议问题