How do I adjust log4j levels at runtime?

孤者浪人 提交于 2019-12-04 01:04:53

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.

I created a new java application module (jar) to do this in a web interface at runtime, and also have a page to view the log result. Configure the jar is very simple: must be placed in the /WEB-INF/lib folder, and add a mapping to the servlet in the /WEB-INF/web.xml file.

Project site: http://www.log4jwebtracker.com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!