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 Yoav Shapira <sh...@mpi.com> on 2001/11/01 15:17:07 UTC

Re: Web Apps and Common Files Use Log4J

Howdy ;)

I have the log4j jar file in the common lib, and the log4j.properties
file for each webapp in a different location, that's passed as init
param to each webapp's init servlet.  In that file is the location of
the log file for app (absolute path).  For me, the result is one log4j
jar, separate config and log files for each app...

Yoav


"Millard, Ray" wrote:
> 
> This is not the problem.
> 1.  We already have a separate init servlet for each web app.
> 2.  We already have the log4j.jar file in the WEB-INF\lib folder for each
> web app.
> 
> The problem is:
> 
>         > 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?
> 
> > -----Original Message-----
> > From: Yoav Shapira [SMTP:shapira@mpi.com]
> > Sent: Wednesday, October 31, 2001 10:26 AM
> > To:   Log4J Users List
> > Subject:      Re: Web Apps and Common Files Use Log4J
> >
> > 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:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>