简体   繁体   中英

Override log4j.xml configuration over external libraries log4j.xml

Since I added a external jar file to my project, the log4j configuration is being picked up from the log4j.xml which is inside the external jar file. The log4j.xml configuration within my application is not getting applied.

Is there a way to override the log4j.xml configuration so that my applications log4j.xml gets picked?

EAR Structure :

\\lib\\externalJar\\log4j.xml

\\appweb.war\\WEB-INF\\classes\\log4j.xml

I can see the warning in the log file as : log4j:WARN No appenders could be found for logger.

Thanks in advance

If you bundle the the required log4j jar file into your webapp's WEB-INF/lib directory, then the webapps's classloader will load the log4j classes, and you can use your own configuration. This will be separate from the instance of log4j loaded by the ear classloader, and used by the external jar you added.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM