Armin Häberling wrote:
I'm facing the following problem. We have a tomcat instance with
multiple webapps. The apps share many libraries in shared/lib directory,
some of them use log4j and some apache commons-logging.
Currently all the apps log to the same log file, which is suboptimal. We
like to have one log file per webapp.
AFAIK one solution for this is to put for each webapp a log4j jar in the
WEB_INF/lib directory and a separate log4j.properties.
As far as I understand the tomcat classloader hierarchy, all libraries
in shared/lib that use log4j must then also be moved to WEB_INF/lib
directory of the webapp. (please correct me if I'm wrong!).
Unfortunately this is not possible in our specific case.
You might also consider using the NDC functionality of log4j;
that is, do not write logs from within the library, but instead add data
to a NDC initialized by the application, and write the log from within
the application.
Having said that, I have some code (though in a sad state of incompleteness)
that would provide a webapp-based log4j RepositorySelector for Tomcat. However,
I'm not certain how it would behave with things loaded from shared/lib
(as it's based on detecting distinct classloaders). This code, if I ever
have the time to get it even into semi-releasable state, would allow each
webapp to have its own log4j configuration (but still share one common
log4j library).
--
..Juha
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]