Re: setting up multiple log4j configurations for multiple WAR pac kage s?
So if the server itself uses log4j for logging, does that mean that you will not be able to configure individual web apps to work independently of each other and or the server? On Friday, November 21, 2003, at 07:36 AM, [EMAIL PROTECTED] wrote: IMHO, the simplest and easiest configuration to maintain is to place log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR. This should work fine without any additional server configuration. You should not have log4j.jar in your server's classpath or logging won't be separate between webapps. Ken -Original Message- From: Yuzwa, Erik [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 8:30 AM To: 'Log4J Users List' Subject: setting up multiple log4j configurations for multiple WAR package s? Hi all, I'm sorry if this is a FAQ, as I've looked everywhere and can't find very many resources on setting up multiple log4j configurations for different WAR packages (ie. a seperate set of log files for each WAR app). I've tried including a log4j.xml and log4j.blah.jar file with each WAR, but that doesn't seem to work properly. Is there a configuration setting that I'm missing on the servlet container itself? Should the log4j.blah.jar file be in the classpath of the servlet container or remain on the application layer? thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: setting up multiple log4j configurations for multiple WAR pac kage s?
No, his statement is incorrect. You can utilize a repository selector to separate logging using a single instance of log4j.jar. Read here... http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging In fact, if you use Tomcat, even without using a repository selector, you can provide for container logging and webapp logging, all completely separated. Put log4j.jar in CATALINA_HOME/common/lib, put a log4j.xml in CATALNIA_HOME/common/classes, and then put log4j.jar in each WEB-INF/lib and either do manual configuration with log4j.xml somewhere like WEB-INF or do auto-config with it in WEB-INF/classes. All your logging should be separated without even bothering with a repository selector. This behavior depends on the way the class loaders are set up, though. Tomat loads classes and resources from the WebappClassLoader preferentially to higher class loaders. This is opposite the normal Java2 class loader behavior, but defined (I believe) by the servlet spec. Other containers such as JBoss don't seem to do this by default, although you can configure them to do it. As such, using the repository selectors is the only guaranteed way to achieve separated logging. Jake At 04:01 AM 11/22/2003 -0800, you wrote: So if the server itself uses log4j for logging, does that mean that you will not be able to configure individual web apps to work independently of each other and or the server? On Friday, November 21, 2003, at 07:36 AM, [EMAIL PROTECTED] wrote: IMHO, the simplest and easiest configuration to maintain is to place log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR. This should work fine without any additional server configuration. You should not have log4j.jar in your server's classpath or logging won't be separate between webapps. Ken -Original Message- From: Yuzwa, Erik [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 8:30 AM To: 'Log4J Users List' Subject: setting up multiple log4j configurations for multiple WAR package s? Hi all, I'm sorry if this is a FAQ, as I've looked everywhere and can't find very many resources on setting up multiple log4j configurations for different WAR packages (ie. a seperate set of log files for each WAR app). I've tried including a log4j.xml and log4j.blah.jar file with each WAR, but that doesn't seem to work properly. Is there a configuration setting that I'm missing on the servlet container itself? Should the log4j.blah.jar file be in the classpath of the servlet container or remain on the application layer? thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: setting up multiple log4j configurations for multiple WAR pac kage s?
Thanks a lot for the responses Jake! I'll investigate this repository selector solution as you've suggested. We did some brief tests coding our own Configurator, which seemed to do *exactly* what we wanted during the server initialization (ie. it would scroll through each WAR package with log4j, and dump the logs at a location of our choosing.) However, in our environment, we typically do a lot of hot deploys, rather than restarting the server every time. Whenever we'd do a hot deploy, the Configurator was then never called. :( Hopefully this repository selector will work out..*cross fingers* I DID successfully get individual logging by removing ANY log4j.xml and jar files (along with common logging), from the server/lib folder, and just keeping it self-contained within each WAR package. So at least *that*'s working..:) thanks again everyone! Erik -Original Message- From: Jacob Kjome To: Log4J Users List Sent: 11/22/2003 6:01 AM Subject: Re: setting up multiple log4j configurations for multiple WAR pac kage s? No, his statement is incorrect. You can utilize a repository selector to separate logging using a single instance of log4j.jar. Read here... http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContai nerLogging In fact, if you use Tomcat, even without using a repository selector, you can provide for container logging and webapp logging, all completely separated. Put log4j.jar in CATALINA_HOME/common/lib, put a log4j.xml in CATALNIA_HOME/common/classes, and then put log4j.jar in each WEB-INF/lib and either do manual configuration with log4j.xml somewhere like WEB-INF or do auto-config with it in WEB-INF/classes. All your logging should be separated without even bothering with a repository selector. This behavior depends on the way the class loaders are set up, though. Tomat loads classes and resources from the WebappClassLoader preferentially to higher class loaders. This is opposite the normal Java2 class loader behavior, but defined (I believe) by the servlet spec. Other containers such as JBoss don't seem to do this by default, although you can configure them to do it. As such, using the repository selectors is the only guaranteed way to achieve separated logging. Jake At 04:01 AM 11/22/2003 -0800, you wrote: So if the server itself uses log4j for logging, does that mean that you will not be able to configure individual web apps to work independently of each other and or the server? On Friday, November 21, 2003, at 07:36 AM, [EMAIL PROTECTED] wrote: IMHO, the simplest and easiest configuration to maintain is to place log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR. This should work fine without any additional server configuration. You should not have log4j.jar in your server's classpath or logging won't be separate between webapps. Ken -Original Message- From: Yuzwa, Erik [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 8:30 AM To: 'Log4J Users List' Subject: setting up multiple log4j configurations for multiple WAR package s? Hi all, I'm sorry if this is a FAQ, as I've looked everywhere and can't find very many resources on setting up multiple log4j configurations for different WAR packages (ie. a seperate set of log files for each WAR app). I've tried including a log4j.xml and log4j.blah.jar file with each WAR, but that doesn't seem to work properly. Is there a configuration setting that I'm missing on the servlet container itself? Should the log4j.blah.jar file be in the classpath of the servlet container or remain on the application layer? thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]