简体   繁体   中英

Configure log4j in project

I have created an EAR project where I have implemented log4j. Now I wanted to externalized the log4j.xml somewhere at classpath of the WAS server which means I want to remove it from my project and place it at WAS server classpath.

In which file I have to configure log4j.xml path? Will it be application.xml ?

Like in Web project we configure log4j.xml in web.xml .

Ex:

<context-param>
  <param-name>log4jConfigLocation</param-name>
  <param-value>/WEB-INF/resource/log4j.properties</param-value>
</context-param>
<listener>
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

You should be able to set the path to your log4j config file by updating the startup script of your server to include in its startup path. Like so: -Dlog4j.configuration=file:<path to log4j.xml> Alternatively, you can update WAS's JVM arguments from within the Admin console to include path to your log4j config. It should be somewhere under Servers -> Process Definition -> JVM

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