Tomcat and commons logging
Can someone just PLEASE post a simple straight forward example of how to configure a Tomcat system (4.1.x) for once and for all without getting that damn No logger for class xxx exception. *sigh* I want no loggers defined for 3rd party packages (eg the host of jars required for struts 1.1). Well, default loggers that maybe just do nothing would be fine. Where how do I set this? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat and commons logging
Normally this can be solved by add log4j.jar to your classpath. Are you sure it's an exception, not a warning? -Original Message- From: Riaan Oberholzer [mailto:[EMAIL PROTECTED] Sent: Friday, February 27, 2004 5:52 AM To: [EMAIL PROTECTED] Subject: Tomcat and commons logging Can someone just PLEASE post a simple straight forward example of how to configure a Tomcat system (4.1.x) for once and for all without getting that damn No logger for class xxx exception. *sigh* I want no loggers defined for 3rd party packages (eg the host of jars required for struts 1.1). Well, default loggers that maybe just do nothing would be fine. Where how do I set this? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - 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: Log4J and tomcat using Commons logging
Howdy, Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. PropertyConfigurator.configure(getServletContext().getResource(/WEB-INF /config/log4j.properties)); would do the trick. Can also be done as a -D runtime parameter, set in JAVA_OPTS for tomcat. I agree with your assessment of the classloader problem, by the way, as it relates to commons-logging. Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J and tomcat using Commons logging
Hi Larry, In my myapp/WEB-INF/lib I have: log4j-1.2.6.jar In myapp/WEB-INF/classes I have: log4j.properties In common/lib I have: commons-logging-api.jar commons-logging.jar log4j-1.2.6.jar And in server/lib I have no logging files. I intend to use log4j anyway so it is not a major problem if I use it directly rather than through commons-logging. It would however be nice to be able to chop and change the underlying logging implementation without having to change my code. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 18:14 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Hey Jim, Can you help me understand your configuration so I can help identify where the breakdown is? I am most curious about where all the jar files are - common/lib, shared/lib, or WEB-INF/lib? Probably the best info would be directory listings of common/lib, shared/lib, and WEB-INF/lib. I suspect that log4j is being loaded to far up the classloader tree to be able to find your configuration file when used through commons-logging, but when you use it directly, it is loaded again by another classloader that is able to find your configuration file. That is why I was asking if there was a way to tell log4j to use the properties file without relying on the class loader. I do not use log4j, so I do not know what it can do. Larry [EMAIL PROTECTED] 02/14/03 10:38 AM Hi Larry, I am not having a problem with log4j I deploy the log4j.properties to myapp/WEB-INF/classes and it works fine. I would not want to have log4j.properies in common/classes because I want to be able to configure my logging for individaul apps. The problem is if I use commons-logging, this SHOULD use the underlying log4j implementation and the log4j.properties file that I have deployed with my app. With commons-logging you do not log to any particular logging implementation. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 17:11 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging I have never used log4j, but you might try putting the log4j.properties file in common/classes, it means all apps get the same log settings, but may work. :-/ Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. Larry [EMAIL PROTECTED] 02/14/03 09:55 AM Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI
RE: Log4J and tomcat using Commons logging
Hey Jim, I think Yoav's answer is very practical, and in spite of the fact that it would require a code change if you change loggers down the road, it is only a few lines in one place. You should think about it, because it is pretty low-cost, compared to the amount of time we have already spent. ;-) However, in the interest of understanding what is going on, I think what is happening is that the common classloader is loading commons-logging and log4j and looking for configuration there. It cannot find it because at that point, it does not know where to look - the configuration is at a lower level and is not available to the common classloader. Then when you try to use commons logging in myapp, it is not found in the myapp classloader, so it looks up to the common classloader and uses that one with the configuration found there. I would try adding commons-logging.jar to your WEB-INF/lib directory. That way, when the server wants to log, it should be able to. When your app wants to log, it should find commons logging and log4j right there and log4j should find the config there too. I will keep my fingers crossed. ;-) Larry [EMAIL PROTECTED] 02/17/03 02:08 AM Hi Larry, In my myapp/WEB-INF/lib I have: log4j-1.2.6.jar In myapp/WEB-INF/classes I have: log4j.properties In common/lib I have: commons-logging-api.jar commons-logging.jar log4j-1.2.6.jar And in server/lib I have no logging files. I intend to use log4j anyway so it is not a major problem if I use it directly rather than through commons-logging. It would however be nice to be able to chop and change the underlying logging implementation without having to change my code. Regards Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J and tomcat using Commons logging
Hi Larry, Thanks for your help on this. I did have commons-logging.jar in myapp/WEB-INF/lib and also in server/lib but I had to move them because this was causing Tomcat to crash. I have found an email from Remy where he states it is a Tomcat classloader problem which will not be fixed until Tomcat 5. In the meantime I will stich to logging to log4j directly. Thanks again. Jim. PS I hope this has been of help to anyone else having logging problems :) -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 17 February 2003 14:13 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Hey Jim, I think Yoav's answer is very practical, and in spite of the fact that it would require a code change if you change loggers down the road, it is only a few lines in one place. You should think about it, because it is pretty low-cost, compared to the amount of time we have already spent. ;-) However, in the interest of understanding what is going on, I think what is happening is that the common classloader is loading commons-logging and log4j and looking for configuration there. It cannot find it because at that point, it does not know where to look - the configuration is at a lower level and is not available to the common classloader. Then when you try to use commons logging in myapp, it is not found in the myapp classloader, so it looks up to the common classloader and uses that one with the configuration found there. I would try adding commons-logging.jar to your WEB-INF/lib directory. That way, when the server wants to log, it should be able to. When your app wants to log, it should find commons logging and log4j right there and log4j should find the config there too. I will keep my fingers crossed. ;-) Larry [EMAIL PROTECTED] 02/17/03 02:08 AM Hi Larry, In my myapp/WEB-INF/lib I have: log4j-1.2.6.jar In myapp/WEB-INF/classes I have: log4j.properties In common/lib I have: commons-logging-api.jar commons-logging.jar log4j-1.2.6.jar And in server/lib I have no logging files. I intend to use log4j anyway so it is not a major problem if I use it directly rather than through commons-logging. It would however be nice to be able to chop and change the underlying logging implementation without having to change my code. Regards Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] PLEASE READ: The information contained in this email is confidential and intended for the named recipient(s) only. If you are not an intended recipient of this email you must not copy, distribute or take any further action in reliance on it and you should delete it and notify the sender immediately. Email is not a secure method of communication and Nomura International plc cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). Please examine this email for virus infection, for which Nomura International plc accepts no responsibility. If verification of this email is sought then please request a hard copy. Unless otherwise stated any views or opinions presented are solely those of the author and do not represent those of Nomura International plc. This email is intended for informational purposes only and is not a solicitation or offer to buy or sell securities or related financial instruments. Nomura International plc is regulated by the Financial Services Authority and is a member of the London Stock Exchange. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J and tomcat using Commons logging
Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl = sce.getServletContext().getResource(/WEB-INF/config/log4j.prop); PropertyConfigurator.configure(configurationFileUrl); This works from wars, unpacked wars, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:03 PM To: Tomcat Users List Subject: Re: Log4J and tomcat I'll keep you posted if I ever figure something out. The problem prob. is that since the common-logging and log4j use a lot of static objects I'm getting what tomcat has already set up (this is a theory mind you) - Original Message - From: tomcat guy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 12:57 PM Subject: Re: Log4J and tomcat Sloan, sorry can't help you out but if you find a solution I'd be interested in how you came up with the fix... Learnin about log4j it could help in the future - Original Message - From: Sloan Seaman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 12, 2003 3:23 PM Subject: Log4J and tomcat I'm deploying a war file using tomcat and I wish to use Apache's common logging api to log things (log4j behind the scenes). For some reason my configuration file seems to be getting ignored but my log.info msgs are showing up in the console window for Tomcat. Can someone tell me why this is happening? How do I get my app to use my log4j conf file? Thanks! -- Sloan - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] PLEASE READ: The information contained in this email is confidential and intended for the named recipient(s) only. If you are not an intended recipient of this email you must not copy, distribute or take any further action in reliance on it and you should delete it and notify the sender immediately. Email is not a secure method of communication and Nomura International plc cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). Please examine this email for virus infection, for which Nomura International plc accepts no responsibility. If verification of this email is sought then please request a hard copy. Unless otherwise stated any views or opinions presented are solely those of the author and do not represent those of Nomura International plc. This email is intended for informational purposes only and is not a solicitation or offer to buy or sell securities or related financial instruments. Nomura International plc is regulated by the Financial Services
RE: Log4J and tomcat using Commons logging
Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl = sce.getServletContext().getResource(/WEB-INF/config/log4j.prop); PropertyConfigurator.configure(configurationFileUrl); This works from wars, unpacked wars, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:03 PM To: Tomcat Users List Subject: Re: Log4J and tomcat I'll keep you posted if I ever figure something out. The problem prob. is that since the common-logging and log4j use a lot of static objects I'm getting what tomcat has already set up (this is a theory mind you) - Original Message - From: tomcat guy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 12:57 PM Subject: Re: Log4J and tomcat Sloan, sorry can't help you out but if you find a solution I'd be interested in how you came up with the fix... Learnin about log4j it could help in the future - Original Message - From: Sloan Seaman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 12, 2003 3:23 PM Subject: Log4J and tomcat I'm deploying a war file using tomcat and I wish to use Apache's common logging api to log things (log4j behind the scenes). For some reason my configuration file seems to be getting ignored but my log.info msgs are showing up in the console window for Tomcat. Can someone tell me why this is happening? How do I get my app to use my log4j conf file? Thanks! -- Sloan - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] PLEASE READ: The information contained in this email is confidential and intended for the named recipient(s) only. If you are not an intended recipient of this email you must not copy, distribute or take any further action in reliance on it and you should delete it and notify the sender immediately. Email is not a secure method of communication and Nomura International plc cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). Please examine this email for virus infection, for which Nomura International plc accepts no responsibility. If verification of this email is sought then please request a hard copy. Unless otherwise stated any views or opinions presented are solely those of the author and do not represent those of Nomura International plc. This email is intended for
RE: Log4J and tomcat using Commons logging
Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl = sce.getServletContext().getResource(/WEB-INF/config/log4j.prop); PropertyConfigurator.configure(configurationFileUrl); This works from wars, unpacked wars, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:03 PM To: Tomcat Users List Subject: Re: Log4J and tomcat I'll keep you posted if I ever figure something out. The problem prob. is that since the common-logging and log4j use a lot of static objects I'm getting what tomcat has already set up (this is a theory mind you) - Original Message - From: tomcat guy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 12:57 PM Subject: Re: Log4J and tomcat Sloan, sorry can't help you out but if you find a solution I'd be interested in how you came up with the fix... Learnin about log4j it could help in the future - Original Message - From: Sloan Seaman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 12, 2003 3:23 PM Subject: Log4J and tomcat I'm deploying a war file using tomcat and I wish to use Apache's common logging api to log things (log4j behind the scenes). For some reason my configuration file seems to be getting ignored but my log.info msgs are showing up in the console window for Tomcat. Can someone tell me why this is happening? How do I get my app to use my log4j conf file? Thanks! -- Sloan - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied
RE: Log4J and tomcat using Commons logging
I have never used log4j, but you might try putting the log4j.properties file in common/classes, it means all apps get the same log settings, but may work. :-/ Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. Larry [EMAIL PROTECTED] 02/14/03 09:55 AM Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl = sce.getServletContext().getResource(/WEB-INF/config/log4j.prop); PropertyConfigurator.configure(configurationFileUrl); This works from wars, unpacked wars, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:03 PM To: Tomcat Users List Subject: Re: Log4J and tomcat I'll keep you posted if I ever figure something out. The problem prob. is that since the common-logging and log4j use a lot of static objects I'm getting what tomcat has already set up (this is a theory mind you) - Original Message - From: tomcat guy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 12:57 PM Subject: Re: Log4J and tomcat Sloan, sorry can't help you out but if you find a solution I'd be interested in how you came up with the fix... Learnin about log4j it could help in the future - Original Message - From: Sloan Seaman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 12, 2003 3:23 PM Subject: Log4J and tomcat I'm deploying a war file using tomcat and I wish to use Apache's common logging api to log things (log4j behind the scenes). For some reason my configuration file seems to be getting ignored but my log.info msgs are showing up in the console window for Tomcat. Can someone tell me why this is happening? How do I get my app to use my log4j conf file? Thanks! -- Sloan - 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
RE: Log4J and tomcat using Commons logging
Hi Larry, I am not having a problem with log4j I deploy the log4j.properties to myapp/WEB-INF/classes and it works fine. I would not want to have log4j.properies in common/classes because I want to be able to configure my logging for individaul apps. The problem is if I use commons-logging, this SHOULD use the underlying log4j implementation and the log4j.properties file that I have deployed with my app. With commons-logging you do not log to any particular logging implementation. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 17:11 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging I have never used log4j, but you might try putting the log4j.properties file in common/classes, it means all apps get the same log settings, but may work. :-/ Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. Larry [EMAIL PROTECTED] 02/14/03 09:55 AM Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl = sce.getServletContext().getResource(/WEB-INF/config/log4j.prop); PropertyConfigurator.configure(configurationFileUrl); This works from wars, unpacked wars, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:03 PM To: Tomcat Users List Subject: Re: Log4J and tomcat I'll keep you posted if I ever figure something out. The problem prob. is that since the common-logging and log4j use a lot of static objects I'm getting what tomcat has already set up (this is a theory mind you) - Original Message - From: tomcat guy [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 12:57 PM Subject: Re: Log4J and tomcat Sloan, sorry can't help you out but if you find a solution I'd be interested in how you came up with the fix... Learnin about log4j it could help in the future - Original Message - From: Sloan Seaman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 12, 2003 3:23 PM Subject: Log4J and tomcat I'm deploying a war file using tomcat and I wish to use Apache's
RE: Log4J and tomcat using Commons logging
Hey Jim, Can you help me understand your configuration so I can help identify where the breakdown is? I am most curious about where all the jar files are - common/lib, shared/lib, or WEB-INF/lib? Probably the best info would be directory listings of common/lib, shared/lib, and WEB-INF/lib. I suspect that log4j is being loaded to far up the classloader tree to be able to find your configuration file when used through commons-logging, but when you use it directly, it is loaded again by another classloader that is able to find your configuration file. That is why I was asking if there was a way to tell log4j to use the properties file without relying on the class loader. I do not use log4j, so I do not know what it can do. Larry [EMAIL PROTECTED] 02/14/03 10:38 AM Hi Larry, I am not having a problem with log4j I deploy the log4j.properties to myapp/WEB-INF/classes and it works fine. I would not want to have log4j.properies in common/classes because I want to be able to configure my logging for individaul apps. The problem is if I use commons-logging, this SHOULD use the underlying log4j implementation and the log4j.properties file that I have deployed with my app. With commons-logging you do not log to any particular logging implementation. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 17:11 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging I have never used log4j, but you might try putting the log4j.properties file in common/classes, it means all apps get the same log settings, but may work. :-/ Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. Larry [EMAIL PROTECTED] 02/14/03 09:55 AM Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl = sce.getServletContext().getResource(/WEB-INF/config/log4j.prop); PropertyConfigurator.configure(configurationFileUrl); This works from wars, unpacked wars, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:03 PM To: Tomcat Users List Subject: Re: Log4J and tomcat I'll keep you posted if I ever figure something out. The problem prob. is that since the common-logging and log4j use
RE: Log4J and tomcat using Commons logging
According to commons-logging documentation, commons-logging automatically search for available logging config, log4j, jdk, commons-logging, simplelog etc. The idea is good. It makes life much easier using different logging api. I am happy with log4j so why switch? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: February 14, 2003 1:14 PM To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Hey Jim, Can you help me understand your configuration so I can help identify where the breakdown is? I am most curious about where all the jar files are - common/lib, shared/lib, or WEB-INF/lib? Probably the best info would be directory listings of common/lib, shared/lib, and WEB-INF/lib. I suspect that log4j is being loaded to far up the classloader tree to be able to find your configuration file when used through commons-logging, but when you use it directly, it is loaded again by another classloader that is able to find your configuration file. That is why I was asking if there was a way to tell log4j to use the properties file without relying on the class loader. I do not use log4j, so I do not know what it can do. Larry [EMAIL PROTECTED] 02/14/03 10:38 AM Hi Larry, I am not having a problem with log4j I deploy the log4j.properties to myapp/WEB-INF/classes and it works fine. I would not want to have log4j.properies in common/classes because I want to be able to configure my logging for individaul apps. The problem is if I use commons-logging, this SHOULD use the underlying log4j implementation and the log4j.properties file that I have deployed with my app. With commons-logging you do not log to any particular logging implementation. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 17:11 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging I have never used log4j, but you might try putting the log4j.properties file in common/classes, it means all apps get the same log settings, but may work. :-/ Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. Larry [EMAIL PROTECTED] 02/14/03 09:55 AM Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration file. I am sure this would prove useful to a large number of users. Many thanks Jim. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 18:11 To: Tomcat Users List Subject: RE: Log4J and tomcat Howdy, FYI: we deploy in packed .war files (and have unpackWARs=false in the Host elements of server.xml). We use log4j with a properties configuration file. The way we configure log4j is in a servlet listener's contextInitialized(ServletContext sce) method, using URL configurationFileUrl
RE: Log4J and tomcat using Commons logging
If you are sure the logging API you are using is everything you will ever want or need, then you should not switch. If you think there is a possibility that you will ever want to use a different implementation, you shoudl think about switching. We have switched implementations three times since going with commons-logging, but have never needed to change a line of application code - all we have done is reconfigured the commons logging component. The applications still use the same interface, only the underlying implementation has changed. HTH, Larry [EMAIL PROTECTED] 02/14/03 11:25 AM According to commons-logging documentation, commons-logging automatically search for available logging config, log4j, jdk, commons-logging, simplelog etc. The idea is good. It makes life much easier using different logging api. I am happy with log4j so why switch? Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: February 14, 2003 1:14 PM To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Hey Jim, Can you help me understand your configuration so I can help identify where the breakdown is? I am most curious about where all the jar files are - common/lib, shared/lib, or WEB-INF/lib? Probably the best info would be directory listings of common/lib, shared/lib, and WEB-INF/lib. I suspect that log4j is being loaded to far up the classloader tree to be able to find your configuration file when used through commons-logging, but when you use it directly, it is loaded again by another classloader that is able to find your configuration file. That is why I was asking if there was a way to tell log4j to use the properties file without relying on the class loader. I do not use log4j, so I do not know what it can do. Larry [EMAIL PROTECTED] 02/14/03 10:38 AM Hi Larry, I am not having a problem with log4j I deploy the log4j.properties to myapp/WEB-INF/classes and it works fine. I would not want to have log4j.properies in common/classes because I want to be able to configure my logging for individaul apps. The problem is if I use commons-logging, this SHOULD use the underlying log4j implementation and the log4j.properties file that I have deployed with my app. With commons-logging you do not log to any particular logging implementation. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 17:11 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging I have never used log4j, but you might try putting the log4j.properties file in common/classes, it means all apps get the same log settings, but may work. :-/ Is there a way to tell log4j to use the properties file without relying on the class loader, like an environment variable or something? That might make it easier to use. Larry [EMAIL PROTECTED] 02/14/03 09:55 AM Hi Larry, There have been some problems with the location of the commons-logging jar file. It was in server/lib but this causes intermittent problems that causes Tomcat to crash. I have posted this problem to this mail list and the same problem has been published on other mail lists. The fix is to move commons-logging.jar from server/lib to common/lib and not to deploy commons-logging with your webapp. At the moment I have commons-logging.jar only in common/lib and the log4j jar file in common/lib and my apps WEB-INF/lib dir. If I log directly to log4j it uses my log4j.properties file but if I use commons-logging it uses the default. For the moment I will stick to calling log4j directly. It would be nice to clear this up though as a lot of other people are having the same problem trying to use commons-logging. Regards Jim. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: 14 February 2003 15:40 To: [EMAIL PROTECTED] Subject: RE: Log4J and tomcat using Commons logging Where are your commons-logging and log4j jars? If they are loaded by a different classloader than the log4j.properties file, it may not work. Larry [EMAIL PROTECTED] 02/14/03 02:47 AM Hi, I have managed to get log4j to work for my webapps. I just have a log4j.properties file in WEB-INF/classes and it works. I can't get commons-logging to work though. If I try commons-logging it does not pick up my log4j.properties file yet using log4j directly does pick up the file. I have spent a lot of time trawling Tomcat/Struts/Commons mail archives to try and find how to get this to work to no avail. Reading these mail archives I can see that a lot of other people are having the same problem as me. As Tomcat and Struts uses commons-logging could someone please try and clarify how we set up a webapp to use commons-logging with its own configuration