[EMAIL PROTECTED] wrote: > Hi, > > we've got two different applications in two different war-files. In each > war-file there can be found log4j-config with following content: >
<snip/> > > My problem is, that all logfile entries will be appended to > "ApplicationOne.log" even the outputs of the second application. I thought > different applications in different war-files would create different > logfiles, too. The log4j library is located in server/lib in my tomcat so all > applications are using the same libraries. Is there anything that I forgot in > my configuration? By default, each instance of Log4j uses a single logger respository instance for all logging. By "instance of Log4j", I mean one per classloader hierarchy. You have chosen to place your log4j in a location where all webapps can see it. Therefore, all webapps will use the same instance of Log4j and any configuration you perform in any webapp will be applied to the same logger repository. Under Tomcat (standalone) there is a simple solution. Place a separate copy of log4j.jar in each webapp's WEB-INF/lib. Because Tomcat (standalone) implements child-first classloading, it will use log4j.jar from WEB-INF/lib in preference to any log4j.jar instances in parent classloaders. So, you now have a separate logger repository per/webapp. There's another solution which doesn't require you to have separate copies of log4j in each webapp, and doesn't depend on child-first classloading. I'm talking about the logger repository selector. It selects the logger repository based on some unique condition in the environment. For instance, JNDI, classloader, thread, etc... I don't recommend using classloader because it can cause problems with application reloading and cause resource leaks. Search the user list and the web for information. I wrote up some information [1] in the Log4j wiki on this as well. [1] http://wiki.apache.org/logging-log4j/AppContainerLogging > > Many thanks, > Jason Jake --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
