Howdy,
A couple of possible solutions, both predicated on placing the log4j
jar with the common files.

(Do it yourself)
1) If using an init servlet of some kind, simply pass the location
of each configuration file as an init-param to that servlet.  Each
web-app has such a servlet, each one reads a different configuration
file, no problem.

(Let log4j do it for you)
2) Use separate log4j repositories, one per web-app.  This required
log4j 1.2 -- see Section 5.2 of the "introductory manual" that
comes with log4j1.2.  Probably a better solution...

Hope this helps ;)
Yoav

"Millard, Ray" wrote:
> 
> I have a twist on the configuration of Log4J with Web Apps.  Here is our
> situation:
> 
> 1.      We have several web applications that all use a separate log4j XML
> configuration and output files. Theses classes and the LOG4J.jar file are
> located in the WEB-INF/lib directory.
> 
> 2.      We use DOMConfigurator::configureAndWatch to load each web apps XML
> configuration file.
> 
> 2.      We have a set of common files that are used across all web
> applications.  Currently, these classes do not use Log4J.  These classes are
> located in a jar file accessible to all web apps.  For us, this is in
> JRun\Servers\lib.
> 
> 3.      We wish to add log4j to our common files, keep the common files in
> the server classpath (JRun\Servers\lib), and still have separate config and
> output files for each web application.
> 
> When we put log statements in the common files, we get
> ClassNotFoundExceptions as expected (The Server classloader can not see the
> log4j.jar file as it is in the WEB-INF\lib folder).
> 
> If we put the log4j file in the JRun\Servers\lib folder (the server
> classloader) then we only get one output file, as the last web app to be
> loaded overrides all other configurations.
> 
> If we put the common files in each WEB-INF/lib directory, we get a separate
> output file for each web app (what we want), however, we then have multiple
> copies of our common files on our server.
> 
> How do we keep the common files in the server classpath (To be loaded by the
> server classloader), yet still maintain separate configuration and log files
> for each web app?
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to