Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   log4j, tomcat and multiple webapps (http://www.velocityreviews.com/forums/t146557-log4j-tomcat-and-multiple-webapps.html)

PeterH 09-29-2005 11:28 AM

log4j, tomcat and multiple webapps
 
Hi all,

I have a number of different webapps deployed which are all logging to the
same log file, depending on which one is started first and how the server
is feeling at the time.

The log4j.properties files start with a line of the format:

log4j.logger.<package>.<class>=DEBUG, R

In the matching classfile in the webapp, the logger is declared as:

private static Log log = LogFactory.getLog(<class>.class);


Where am I going wrong?

Raymond DeCampo 10-08-2005 02:00 AM

Re: log4j, tomcat and multiple webapps
 
PeterH wrote:
> Hi all,
>
> I have a number of different webapps deployed which are all logging to the
> same log file, depending on which one is started first and how the server
> is feeling at the time.
>
> The log4j.properties files start with a line of the format:
>
> log4j.logger.<package>.<class>=DEBUG, R
>
> In the matching classfile in the webapp, the logger is declared as:
>
> private static Log log = LogFactory.getLog(<class>.class);
>
>
> Where am I going wrong?


The typical thing to do with log4j in a web container is to supply each
web application with its own log4j.jar. The class loading rules for web
applications imply that each web application will get its own version of
the log4j classes, and so then will not share the static configuration
information.

HTH,
Ray

--
XML is the programmer's duct tape.

Juha Laiho 10-09-2005 07:42 AM

Re: log4j, tomcat and multiple webapps
 
Raymond DeCampo <nospam@twcny.rr.com> said:
>PeterH wrote:
>> I have a number of different webapps deployed which are all logging to the
>> same log file, depending on which one is started first and how the server
>> is feeling at the time.

....
>The typical thing to do with log4j in a web container is to supply each
>web application with its own log4j.jar. The class loading rules for web
>applications imply that each web application will get its own version of
>the log4j classes, and so then will not share the static configuration
>information.


The other possibility (to keep a single set of log4j classes shared among
the applications) would be to use (write) a RepositorySelector to bridge
between Tomcat and Log4j.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


All times are GMT. The time now is 12:41 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.