You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Priya Ingle <in...@yahoo.com> on 2005/10/06 19:50:08 UTC

log4j and multiple server instances

Hi,
 
We have one j2ee application with only one ear. We have the log4j.jar at ear level under lib directory and then we set up LD_LIBRARY_PATH (through WebSphere - which is done at server scope) to point to that folder so that our utility jar and war can pick log4j.jar and log4j.properties from ear/lib. We are running this application on websphere running on Linux box.
 
With this configuration, it was running fine, creating our custom log files at specified location in log4j.properties. 
 
Now, I have created 2 instances of server on the same machine - one for development, one for testing. I installed the same ear on the newly created server instance, changed log4j.properties to write log files in different directory tree. So now, I have 2 instances of websphere servers running on same machine, running basically same application (with it's own copy of everything off course).
 
But, I see that the logs that should be have been created by this 2nd application are still being written in the log file that was initially created by 1st instance. The 2nd application never created it's own log files under the new directory specified in it's own log4j.properties.
 
As I understand, 2 different instances of server have 2 seperate jvms, also they have their own copy of log4j.  Hence, even if log4j is singleton, that shouldn't matter and it should have been totally unaware about the 1st application and hence 1st log4j. Thus the 2nd application should have created it's own log files and written logs there.
 
Can anyone shed any light on what I may be missing?
 
Thanks,
Priya


		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 

Re: log4j and multiple server instances

Posted by Jacob Kjome <ho...@visi.com>.
If the two different log4j.properties files actually log to two distinct
directories, I would guess that either your classpath is set up for both
WebSphere instances to look at only one of those config files.  If they are
usin the same config file, they would attempt to write to the same file in the
same directory.  Otherwise, one instance, if it isn't finding the
log4j.properties that you think it is and isn't finding the one meant for the
other server, still might be finding a rogue copy of log4j.properties somewhere
in the classpath.  Start up the servers with -Dlog4j.debug=true to get to the
bottom of this.

Jake

Quoting Priya Ingle <in...@yahoo.com>:

> Hi,
>
> We have one j2ee application with only one ear. We have the log4j.jar at ear
> level under lib directory and then we set up LD_LIBRARY_PATH (through
> WebSphere - which is done at server scope) to point to that folder so that
> our utility jar and war can pick log4j.jar and log4j.properties from ear/lib.
> We are running this application on websphere running on Linux box.
>
> With this configuration, it was running fine, creating our custom log files
> at specified location in log4j.properties.
>
> Now, I have created 2 instances of server on the same machine - one for
> development, one for testing. I installed the same ear on the newly created
> server instance, changed log4j.properties to write log files in different
> directory tree. So now, I have 2 instances of websphere servers running on
> same machine, running basically same application (with it's own copy of
> everything off course).
>
> But, I see that the logs that should be have been created by this 2nd
> application are still being written in the log file that was initially
> created by 1st instance. The 2nd application never created it's own log files
> under the new directory specified in it's own log4j.properties.
>
> As I understand, 2 different instances of server have 2 seperate jvms, also
> they have their own copy of log4j.  Hence, even if log4j is singleton, that
> shouldn't matter and it should have been totally unaware about the 1st
> application and hence 1st log4j. Thus the 2nd application should have created
> it's own log files and written logs there.
>
> Can anyone shed any light on what I may be missing?
>
> Thanks,
> Priya
>
>
>
> ---------------------------------
> Yahoo! for Good
>  Click here to donate to the Hurricane Katrina relief effort.




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org