解决web项目存在多个log4j.properties配置文件,导致日志级别配置不生效问题

时间:2022-02-16 15:07:23

java开启log4j的debug模式

-Dlog4j.debug=true

tomcat启动debug模式:

linux打开catalina.sh导入:

export JAVA_OPTS="$JAVA_OPTS -Dlog4j.debug=true"

启动后打印日志:

og4j: Using URL [file:/tomcat/webapps/api/WEB-INF/classes/log4j.properties] for automatic log4j configuration.

log4j: Reading configuration from URL file:/tomcat/webapps/api/WEB-INF/classes/log4j.properties

log4j: Parsing for [root] with value=[WARN,appendConsole,errorlog,stdout].