Problem with logging separation between webapps and container
I'm using Resin Servlet Container. I have developed librairies(jar files) that are shared by many web applications, I have put my libraries jar in the global classpath of the servlet container. In those librairies, I'm using log4j as logging mechanism with an xml configuration file. Everything was working fine. The problem I have is when I used log4j with Struts in a webapp. There is a conflict, only the logging from the webapp works. I understand that this is a ClassLoader issue as described in the lo4j documentation. I don't want to configure my libraries logging in each webapp but having this kind of logging configured at the server level. To fix the problem, I tried implementing a custom repository selector (taken from the sandbox by Jacob Kjome) in my webapp so that both hierarchies worked at the same time without any conflicts. Even though it's supposed to fix the problem, the webapp logging overwrites the server appenders. I have this warning: log4j:WARN No appenders could be found for logger (DbController.class). log4j:WARN Please initialize the log4j system properly. log4j: Finalizing appender named [CONSOLE]. Any ideas on how to make this work? thank in advance, Stephanie St-Cyr Software developer AstraZeneca here is my two xml configuration files: the server one: ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=CONSOLE class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p line %L -%m%n/ /layout /appender root level value=DEBUG/ appender-ref ref=CONSOLE / /root !-- database logger -- logger name=com.codestudio.util.PoolSkimmerThread additivity=false level value=INFO / appender-ref ref=CONSOLE / /logger logger name=com.azrdm.util.DbControler additivity=false level value=DEBUG / appender-ref ref=CONSOLE / /logger /log4j:configuration and the webapp: ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=X class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p line %L -%m%n/ /layout /appender logger name=org.apache.commons.validator.ValidatorResources additivity=false level value=WARN/ appender-ref ref=X/ /logger logger name=org.apache.struts.validator.ValidatorPlugIn additivity=false level value=WARN/ appender-ref ref=X/ /logger logger name=org.apache.struts.util.PropertyMessageResources additivity=false level value=WARN/ appender-ref ref=X/ /logger /log4j:configuration - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with logging separation between webapps and container
Howdy, I'm using Resin Servlet Container. I have developed librairies(jar files) that are shared by many web applications, I have put my libraries jar in the global classpath of the servlet container. You problem pretty much starts and ends here. Disk space is cheap: have each app's jars in its own WEB-INF/lib directory. Don't use the server's global classpath for your apps. Yoav Shapira 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: Problem with logging separation between webapps and container
I moved commons-logging.properties and simpleLog.properties and if you have a log4j.properites to /WEB-INF/Classes. May be moving dtds /WEB-INF/dtds may help. Not sure never worked with Resin servlet container. And in the web.xml define: !-- log4j parameters -- init-param param-namelog4j-priority/param-name param-valueDEBUG/param-value /init-param init-param param-namelog4j-layout/param-name param-value%-5p [%M] %m%n/param-value /init-param !-- end log4j parameters -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 3:19 PM To: [EMAIL PROTECTED] Subject: Problem with logging separation between webapps and container I'm using Resin Servlet Container. I have developed librairies(jar files) that are shared by many web applications, I have put my libraries jar in the global classpath of the servlet container. In those librairies, I'm using log4j as logging mechanism with an xml configuration file. Everything was working fine. The problem I have is when I used log4j with Struts in a webapp. There is a conflict, only the logging from the webapp works. I understand that this is a ClassLoader issue as described in the lo4j documentation. I don't want to configure my libraries logging in each webapp but having this kind of logging configured at the server level. To fix the problem, I tried implementing a custom repository selector (taken from the sandbox by Jacob Kjome) in my webapp so that both hierarchies worked at the same time without any conflicts. Even though it's supposed to fix the problem, the webapp logging overwrites the server appenders. I have this warning: log4j:WARN No appenders could be found for logger (DbController.class). log4j:WARN Please initialize the log4j system properly. log4j: Finalizing appender named [CONSOLE]. Any ideas on how to make this work? thank in advance, Stephanie St-Cyr Software developer AstraZeneca here is my two xml configuration files: the server one: ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=CONSOLE class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p line %L -%m%n/ /layout /appender root level value=DEBUG/ appender-ref ref=CONSOLE / /root !-- database logger -- logger name=com.codestudio.util.PoolSkimmerThread additivity=false level value=INFO / appender-ref ref=CONSOLE / /logger logger name=com.azrdm.util.DbControler additivity=false level value=DEBUG / appender-ref ref=CONSOLE / /logger /log4j:configuration and the webapp: ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=X class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p line %L -%m%n/ /layout /appender logger name=org.apache.commons.validator.ValidatorResources additivity=false level value=WARN/ appender-ref ref=X/ /logger logger name=org.apache.struts.validator.ValidatorPlugIn additivity=false level value=WARN/ appender-ref ref=X/ /logger logger name=org.apache.struts.util.PropertyMessageResources additivity=false level value=WARN/ appender-ref ref=X/ /logger /log4j:configuration - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail and any of its attachments may contain Exelon Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Exelon Corporation family of Companies. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. - To unsubscribe, e-mail: [EMAIL
Can log4j work with J++ 6.0 from Microsoft?
Hi - I have a need to write something in Microsoft J++ 6.0 Is there any chance that log4j will work with it? Thanks Betty
RE: Can log4j work with J++ 6.0 from Microsoft?
Doubtful since J++ is stuck at something like JDK 1.1.7 which didn't include the Collections libraries, among other things, that JDK 1.2 added. -Original Message- From: Chang, Betty [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 15:39 To: [EMAIL PROTECTED] Subject: Can log4j work with J++ 6.0 from Microsoft? Hi - I have a need to write something in Microsoft J++ 6.0 Is there any chance that log4j will work with it? Thanks Betty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
not priting line numbers
Using log4j and the formatter is set to print the line# and filename. This information is not being output for my code but is output for Hibernate, which is used in the proejct. What could cause this? How can it be fixed? j2sdk1.4.2 on winnt4 debugging info is enabled optimization is off thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I do to change the properties file for log4j intoanother directory?
use PropertyConfigurator.configure() -Rishi On Wed, 05 Nov 2003 11:29:14 +1100, Tuan Jean Tee [EMAIL PROTECTED] said: I am using the Log Tag Library 1.0 from Jakarta Project. In the Installation document, it suggest that in order to initialize Log4j automatically, the log4j.properties file will have to be placed in /WEB-INF/classes. How could I put the log4j.properties file in /WEB-INF/classes/config directory? What do I have to do? Thank you. IMPORTANT - This email and any attachments are confidential and may be privileged in which case neither is intended to be waived. If you have received this message in error, please notify us and remove it from your system. It is your responsibility to check any attachments for viruses and defects before opening or sending them on. Where applicable, liability is limited by the Solicitors Scheme approved under the Professional Standards Act 1994 (NSW). Minter Ellison collects personal information to provide and market our services. For more information about use, disclosure and access, see our privacy policy at www.minterellison.com. ciao, Rishi - Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself... And see if we may not eff it after all. -- http://www.fastmail.fm - Send your email first class - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging to 2 destinations
Use two separate file appenders, each pointing to its own file (eg application.log and junit.log). Then, I recommend that you define stuff in the root logger that you'd want for your most common logging activities; probably the stuff going to application.log. After that, define a logger for your junit tests. Provide a reference to the junit appender, give it a level, and set additivity to false such as... logger name=test.com.mycompany.mypackage additivity=falselevel value=debug/appender-ref ref=JUnitAppender//logger That will end up acting, essentially, as the root logger for your junit tests and you will have entirely separated logging for application and junit classes. Jake At 08:00 PM 11/5/2003 -0600, you wrote: 1. how can the same log output be sent to two syslogs and a file? 2. I am running JUnit and my Application. They both use log4j Just running the application, all is logged in the expected file. When running tests, via JUnit, the JUnit test output ends up in the Application logs. How can this be separated to go to 2 diff files at test time? -- = = Management is doing things right; leadership is doing the = = right things.- Peter Drucker= =___= = http://www.sun.com/service/sunps/jdc/javacenter.pdf = = www.sun.com | www.javasoft.com | http://www.sun.com/sunone = = - 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: How do I do to change the properties file for log4j into another directory?
At 11:29 AM 11/5/2003 +1100, you wrote: I am using the Log Tag Library 1.0 from Jakarta Project. In the Installation document, it suggest that in order to initialize Log4j automatically, the log4j.properties file will have to be placed in /WEB-INF/classes. How could I put the log4j.properties file in /WEB-INF/classes/config directory? What do I have to do? Thank you. If you are going to create a config dir, why not do it directly under WEB-INF rather than where classes are put? You can load up an input stream using context.getResourceAsStream(WEB-INF/config/log4j.properties) and feed that info a Properties object, then send that into PropertyConfigurator.configure(Properties) or load up a URL using context.getResource(WEB-INF/config/log4j.properties) and send that info PropertyConfigurator.configure(URL). Of course you can still do this even if you leave the config directory under WEB-INF/classes and use the same technique above. Whatever you feel comfortable with. I just like not cluttering my classpath with non-classes. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with logging separation between webapps and container
I'd listen to Yoav here and keep your libs with each app. However, I'm wondering why this isn't working for you. What does your repository selector use to distinguish different logger repositories? Are you sure it is actually being used by your webapp? Note that commons-logging does some crazy stuff and could be interfering here. commons-logging is almost reason enough to avoid using Struts, if you ask me (but you didn't, so I won't go on). I've done plenty of testing where log4j.jar is in a global classloader which many webapps use and the repository selector stuff works like a charm to separate logging without having to put log4j.jar in each webapp. However, I haven't much tested the case where those webapps share other libraries in a global classloader, simply because it isn't a very controllable environment for a webapp. Maybe you can keep testing to make sure your repository selector is doing what you think it is doing but, in the end, I'd still follow Yoav's advice. Jake At 10:18 PM 11/5/2003 +0100, you wrote: I'm using Resin Servlet Container. I have developed librairies(jar files) that are shared by many web applications, I have put my libraries jar in the global classpath of the servlet container. In those librairies, I'm using log4j as logging mechanism with an xml configuration file. Everything was working fine. The problem I have is when I used log4j with Struts in a webapp. There is a conflict, only the logging from the webapp works. I understand that this is a ClassLoader issue as described in the lo4j documentation. I don't want to configure my libraries logging in each webapp but having this kind of logging configured at the server level. To fix the problem, I tried implementing a custom repository selector (taken from the sandbox by Jacob Kjome) in my webapp so that both hierarchies worked at the same time without any conflicts. Even though it's supposed to fix the problem, the webapp logging overwrites the server appenders. I have this warning: log4j:WARN No appenders could be found for logger (DbController.class). log4j:WARN Please initialize the log4j system properly. log4j: Finalizing appender named [CONSOLE]. Any ideas on how to make this work? thank in advance, Stephanie St-Cyr Software developer AstraZeneca here is my two xml configuration files: the server one: ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=CONSOLE class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p line %L -%m%n/ /layout /appender root level value=DEBUG/ appender-ref ref=CONSOLE / /root !-- database logger -- logger name=com.codestudio.util.PoolSkimmerThread additivity=false level value=INFO / appender-ref ref=CONSOLE / /logger logger name=com.azrdm.util.DbControler additivity=false level value=DEBUG / appender-ref ref=CONSOLE / /logger /log4j:configuration and the webapp: ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=X class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p line %L -%m%n/ /layout /appender logger name=org.apache.commons.validator.ValidatorResources additivity=false level value=WARN/ appender-ref ref=X/ /logger logger name=org.apache.struts.validator.ValidatorPlugIn additivity=false level value=WARN/ appender-ref ref=X/ /logger logger name=org.apache.struts.util.PropertyMessageResources additivity=false level value=WARN/ appender-ref ref=X/ /logger /log4j:configuration - 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]