Hello
I have a log4j.jar, .war and ejb.jar file inside the .ear file.
the property file is also in the root of the ear file. now my question is
do i have to initialize(do propertyConfigurator(prop)) in both the
war and ejb jar, or just once in say the .war file?...do the ejb module and
war module run in the same JVM so that they are able to use the same log4j
instance?
i am using weblogic6.1
thanks in advance
-Ram
-
intializing log4j in a .ear file (4 messages)
- Posted by: sriram chandra
- Posted on: May 24 2004 19:41 EDT
Threaded Messages (4)
- intializing log4j in a .ear file by Bhagvan K on May 24 2004 20:08 EDT
- intializing log4j in a .ear file by sriram chandra on May 24 2004 21:36 EDT
- intializing log4j in a .ear file by Joe Attardi on May 25 2004 16:19 EDT
- intializing log4j in a .ear file by sriram chandra on May 24 2004 23:10 EDT
-
intializing log4j in a .ear file[ Go to top ]
- Posted by: Bhagvan K
- Posted on: May 24 2004 20:08 EDT
- in response to sriram chandra
hi,
To start with, you need to rethink where to place the log4j [related
to class loaders for webapp and ejb]
http://logging.apache.org/log4j/docs/TROUBLESHOOT.html
http://www.onjava.com/pub/a/onjava/2003/04/02/log4j_ejb.html
If the log4j.jar is loaded by Extensions Classloader [weblogic commons], then the log4j can be initialized by the Startup Class.
If log4j is bundled individually in a separate jar or in war or ejb.jar, log4j needs to be initialized in both web container and ejb container.
Bhagvan K
http://www.architectcorner.com -
intializing log4j in a .ear file[ Go to top ]
- Posted by: sriram chandra
- Posted on: May 24 2004 21:36 EDT
- in response to sriram chandra
thanks...but...
does this mean say..i am actually using extension mechnism..and log4j.jar is
referenced in the manifest of the .war file. Also i initialize the log4j
in say a static initializer or a seperate servlet...then would the ejb.jar classes also be able to use the same log4j instance...i mean this is only possible if both the ejb and war containers execute in the same JVM instance.
So my question is do they run in the same JVM instance if packaged in an .ear?
i hope u got my question :)
thanks in advance
-ram -
intializing log4j in a .ear file[ Go to top ]
- Posted by: Joe Attardi
- Posted on: May 25 2004 16:19 EDT
- in response to sriram chandra
Hi Sriram...
It depends on your configuration whether or not they run in the same JVM. Usually, in most appservers by default, it runs in the same JVM.
I am taking a similar approach with a project I'm working on. I just have a separate EventLog class, which contains a static initializer to initialize log4j.
Have your Web components and EJB components all call logging methods in the same EventLog class (I use static methods). In this case, you can be sure they're using the same log4j instance.
Hope this helps...
Joe -
intializing log4j in a .ear file[ Go to top ]
- Posted by: sriram chandra
- Posted on: May 24 2004 23:10 EDT
- in response to sriram chandra
Another question:
If we place the log4j in weblogic class path so that all .ears in ther server
can use it...and place seperate log4j.properties in individual .ears...will this be a problem?...or is it ok because the .ears are loaded by seperate classloaders?
-ram