This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Websphere and the fly likes log4j configuration in EAR In Web sphere application server 7.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "log4j configuration in EAR In Web sphere application server 7.0" Watch "log4j configuration in EAR In Web sphere application server 7.0" New topic
Author

log4j configuration in EAR In Web sphere application server 7.0

Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
I am trying to configure log4j at EAR level. I mean I want to have the log4j.properties specified in the EAR so that the WebApp and EJB modules (deployed in separate jars) can share the same lo4j configuration.

My environment is WAS 7.0 , I use RAD 7.5. Any suggestion is appreciated



Thanks
balaji subbu
Greenhorn

Joined: Nov 14, 2011
Posts: 11
yes you can copy the log4j.properties in config directory of WAS(IBM\WebSphere\AppServer\profiles\AppSrv01\config)

and use the below code to access it.

this.LogconfigPath = ("" + (file.getAbsolutePath() == null ? "" : file.getAbsolutePath()));
this.LogconfigPath = (this.LogconfigPath + File.separator +"Log4J.properties");
balaji subbu
Greenhorn

Joined: Nov 14, 2011
Posts: 11
For you use

LogconfigPath = (new StringBuilder()).append("").append(file.getAbsolutePath() == null ? "" : file.getAbsolutePath()).toString();
LogconfigPath = (new StringBuilder()).append(LogconfigPath).append(File.separator).append("Log4J.properties").toString();
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j configuration in EAR In Web sphere application server 7.0
 
Similar Threads
Manifest file not working in J2EE project?
Getting Log4J working in RAD 7.0
Any body use Log4J with Tomcat?
RAD7 - Trying to get log4j to work
Own configure for Log4j