Re: tomcat and log4j, again
1. look into using fileappenders, or even better rolling file appenders. 2. in the log4j api find patternlayout. it has very good documentation. d Used to output the date of the logging event. The date conversion specifier may be followed by a date format specifier enclosed between braces. For example, %d{HH:mm:ss,SSS} or %d{dd MMM HH:mm:ss,SSS}. If no date format specifier is given then ISO8601 format is assumed. The date format specifier admits the same syntax as the time pattern string of the http://java.sun.com/products/jdk/1.3/docs/api/java/text/SimpleDateFormat.htmlSimpleDateFormat. Although part of the standard JDK, the performance of SimpleDateFormat is quite poor. For better results it is recommended to use the log4j date formatters. These can be specified using one of the strings ABSOLUTE, DATE and ISO8601 for specifying ../../../org/apache/log4j/helpers/AbsoluteTimeDateFormat.htmAbsoluteTimeDateFormat, ../../../org/apache/log4j/helpers/DateTimeDateFormat.htmDateTimeDateFormat and respectively ../../../org/apache/log4j/helpers/ISO8601DateFormat.htmISO8601DateFormat. For example, %d{ISO8601} or %d{ABSOLUTE}. These dedicated date formatters perform significantly better than http://java.sun.com/products/jdk/1.3/docs/api/java/text/SimpleDateFormat.htmlSimpleDateFormat. Hope this helps At 12:54 PM 7/3/2003, you wrote: OK, with my current configuration, I *am* seeing output in catalina.out. However, its not formatted the way I (think I) told it to. Also, I would prefer to have the output go to a separate log file, as there is just too much stuff in catalina.out to wade through. Anyway, I am using RH9, jakarta-tomcat-4.1.24, and log4j-1.2.8. For my webapp, I am creating a war file that has log4j.properties in the WEB-INF/classes directory. I dropped log4j-1.2.8.jar into the WEB-INF/lib directory. The log4j.properties file looks like this: log4j.logger.fermataintl.migrasponder=DEBUG, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n = I am not explicitly initializing log4j. A class that I am using in my app invokes logging as follows: package fermataintl.migrasponder.common; import java.sql.*; import org.apache.log4j.*; public class Vendor { ... logger.warn(attempt to authenticate ' + id + ' failed); ... private static Logger logger = Logger.getLogger(Vendor.class); } == When I run my app and exercise the bit of code containing the warning above, it puts the following in catalina.out: 1571947 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed === So... my questions are: 1) How do I get output to a file of my own choosing 2) How do I get the formatting to come out with date and time prepended? Thanks. Dean Hoover PS. I looked for the commercial manual (on the website) at 2 local bookstores and on amazon.com. Nobody has it. I hesitate to order from Switzerland, as I am in the US. How long would that take... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Vladimer Shioshvili QRC Division of Macro International Inc. 7315 Wisconsin Avenue, Suite 400W Bethesda, MD 20814 Phone: (301) 657 3077 ext. 155
RE: tomcat and log4j, again
Howdy, I am not explicitly initializing log4j. A class that I am using in my app invokes logging as follows: package fermataintl.migrasponder.common; import java.sql.*; import org.apache.log4j.*; public class Vendor { ... logger.warn(attempt to authenticate ' + id + ' failed); ... private static Logger logger = Logger.getLogger(Vendor.class); } The above can't compile: did you copy and paste it wrong? 1571947 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed Looks like the default layout, not the one you specified. So... my questions are: 1) How do I get output to a file of my own choosing 2) How do I get the formatting to come out with date and time prepended? Use a FileAppender or one of its variants. Specify the File attribute such that it points to a writable directory/file. Specify the Layout for this FileAppender just like you did for the ConsoleAppender. I don't know why the layout for your console appender wasn't picked up, since you've already said you don't see any errors ever in your logs even with log4j.debug=true. 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: tomcat and log4j, again
PS. WRAX press' Tomcat book has a section on Log4J. Pretty simple, 20 pages tops, but it will get you started. If you can get a handle of that, of course. At 12:54 PM 7/3/2003, you wrote: OK, with my current configuration, I *am* seeing output in catalina.out. However, its not formatted the way I (think I) told it to. Also, I would prefer to have the output go to a separate log file, as there is just too much stuff in catalina.out to wade through. Anyway, I am using RH9, jakarta-tomcat-4.1.24, and log4j-1.2.8. For my webapp, I am creating a war file that has log4j.properties in the WEB-INF/classes directory. I dropped log4j-1.2.8.jar into the WEB-INF/lib directory. The log4j.properties file looks like this: log4j.logger.fermataintl.migrasponder=DEBUG, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n = I am not explicitly initializing log4j. A class that I am using in my app invokes logging as follows: package fermataintl.migrasponder.common; import java.sql.*; import org.apache.log4j.*; public class Vendor { ... logger.warn(attempt to authenticate ' + id + ' failed); ... private static Logger logger = Logger.getLogger(Vendor.class); } == When I run my app and exercise the bit of code containing the warning above, it puts the following in catalina.out: 1571947 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed === So... my questions are: 1) How do I get output to a file of my own choosing 2) How do I get the formatting to come out with date and time prepended? Thanks. Dean Hoover PS. I looked for the commercial manual (on the website) at 2 local bookstores and on amazon.com. Nobody has it. I hesitate to order from Switzerland, as I am in the US. How long would that take... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Vladimer Shioshvili QRC Division of Macro International Inc. 7315 Wisconsin Avenue, Suite 400W Bethesda, MD 20814 Phone: (301) 657 3077 ext. 155 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j, again
Shapira, Yoav wrote: Howdy, I am not explicitly initializing log4j. A class that I am using in my app invokes logging as follows: package fermataintl.migrasponder.common; import java.sql.*; import org.apache.log4j.*; public class Vendor { ... logger.warn(attempt to authenticate ' + id + ' failed); ... private static Logger logger = Logger.getLogger(Vendor.class); } The above can't compile: did you copy and paste it wrong? No, I just showed the important parts. Didn't figure anyone wanted to see the entire file. 1571947 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed Looks like the default layout, not the one you specified. Hmm. Maybe log4j just is never reading my properties file. I don't know why. So... my questions are: 1) How do I get output to a file of my own choosing 2) How do I get the formatting to come out with date and time prepended? Use a FileAppender or one of its variants. Specify the File attribute such that it points to a writable directory/file. Specify the Layout for this FileAppender just like you did for the ConsoleAppender. I don't know why the layout for your console appender wasn't picked up, since you've already said you don't see any errors ever in your logs even with log4j.debug=true. This is what I changed log4.properties to: log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n === I am still not seeing the log file show up. It just goes into catalina.out. I didn't mean to imply that there were no errors in catalina.out. Actually, there seems to be a bunch of stack traces, but none seem related to log4j. Is there some public place that documents all of the ConversionPattern specifiers? or should I just change to *using DateTimeDateFormat? And if so, can you show me the specifics? Do you have any idea why the log file is not being produced? * 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j, again
Shapira, Yoav wrote: Howdy, This is what I changed log4.properties to: log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n BTW, I changed the last line as follows: log4j.appender.l1.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p %F:%L - %m%n That looks fine. === I am still not seeing the log file show up. It just goes into catalina.out. I didn't mean to imply that there were no errors in catalina.out. Actually, there seems to be a bunch of stack traces, but none seem related to log4j. Is there Don't assume that they're not relevant: can you please post them? OK, here goes. I shutdown tomcat, removed catalina.out, and restarted. Here it is: 0 [main] INFO modeler.Registry - Loading registry information 3 [main] INFO modeler.Registry - Creating new Registry instance 449 [main] INFO modeler.Registry - Creating MBeanServer 1217 [main] INFO http11.Http11Protocol - Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.24 4932 [main] ERROR digester.Digester - Parse Error at line 37 column 11: The content of element type web-app must match (icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*). org.xml.sax.SAXParseException: The content of element type web-app must match (icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*). at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1543) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) 5283 [main] INFO http11.Http11Protocol - Starting Coyote HTTP/1.1 on port 8080 5309 [main] INFO common.ChannelSocket - JK2: ajp13 listening on /0.0.0.0:8009 5365 [main]
RE: tomcat and log4j, again
Howdy, OK, here goes. I shutdown tomcat, removed catalina.out, and restarted. Here it is: snip 4932 [main] ERROR digester.Digester - Parse Error at line 37 column 11: The content of element type web-app must match (icon?,display-name?,description?,distributable?,context- param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,sess ion- config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-e nv- ref*,resource-ref*,security-constraint*,login-config?,security-role*,en v- entry*,ejb-ref*,ejb-local-ref*). snip Any idea what all this nonsense is? Far from nonsense, this is the cause for your problems and would've saved us a few messages on both the tomcat-user and this list. The error message is clear, isn't it? Your web.xml is not well-formed: fix it, and everything should be OK. 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: tomcat and log4j, again
Following the discussion on this topic. I am working on using the log4j taglib for the presentation layer( jsps) I also am not seeing anything in caltalina.out nor am not seeing a file being created. Any suggestions? # Sample properties to initialise log4j^M log4j.debug=true^M #log4j.rootCategory=debug, R^M log4j.rootCategory=debug, stdout,R ^M log4j.appender.stdout=org.apache.log4j.ConsoleAppender^M log4j.appender.stdout.layout=org.apache.log4j.PatternLayout^M ^M # Pattern to output the caller's file name and line number.^M log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n^M ^M log4j.appender.R=org.apache.log4j.RollingFileAppender^M log4j.appender.R.File=/apps/tomcat/share/logs/taglib.log ^M log4j.appender.R.MaxFileSize=100KB^M # Keep one backup file^M log4j.appender.R.MaxBackupIndex=2^M ^M log4j.appender.R.layout=org.apache.log4j.PatternLayout^M log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n^M ^M ~ My WEB/INF/lib @BLCUX02:/apps/tomcat/tomcat-worker1/webapps/log-examples/WEB-INF/libls log4j-1.2.7.jar taglibs-log.jar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j, again
At 12:54 PM 7/3/2003 -0400, Dean A. Hoover wrote: PS. I looked for the commercial manual (on the website) at 2 local bookstores and on amazon.com. Nobody has it. I hesitate to order from Switzerland, as I am in the US. How long would that take... You can The complete log4j manual in the US from Softpro books: http://store.yahoo.com/softpro/2-9700369-0-8.html They should have it in stock. Otherwise, your hesitation about purchasing the book from Switzerland is quite normal. Of course, much of the log4j code was written in Switzerland as anyone can guess from the cheesy smell of the code. People in Switzerland are notorious for their feet and the cheesy smell they exude. Some say that it is the Swiss feet that give the cheese its uniquely rich aroma and flavor, or maybe it is the other way around... Interestingly enough, while visiting the US on vacation, a waitress asked us what kind of cheese we wanted in our sandwich. She listed the various sorts and we stopped her as soon as she pronounced the words Swiss cheese. We enthusiastically repeated Swiss cheese with a twinkle in our eyes, yearning for the Gruyere or possibly the Vacherin fribourgeois that we enjoy so much. Talk about a cultural shock when we realized that Swiss cheese in the US means a gooey slice of plastic with holes in it. To be fair, it loosely resembled the Emmental but that is probably stretching the word loosely. Anyway, we loved every minute of our visit, although there were a few rare exceptions which are better kept unshared. If you are wondering if I've lost a marble or two during my stay in London, I've been sick since my return. And the Apache rules specifically state** everyone is allowed to go on a tangent once in a decade. It's my turn. :-) ** If you don't believe me, read the ASF bylaws. It's around section 43 or thereabouts. -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j, again
My suggestion would be to start tomcat and set the log4j.debug property to true. The extra command line argument is -Dlog4j.debug=true This should show which configuration file log4j load if it loads one at all. If your config file is found, you should also see log4j parsing it. BTW, your config file looks OK. At 04:56 PM 7/3/2003 -0400, Dean A. Hoover wrote: Sorry about that. It turns out that I had some tags in the web.xml file in the wrong place. I didn't realize that the order of those tags was important. Anyway. I fixed that, but the file logging is still not working. Here is the catalina.out file: 0 [main] INFO modeler.Registry - Loading registry information 2 [main] INFO modeler.Registry - Creating new Registry instance 471 [main] INFO modeler.Registry - Creating MBeanServer 1214 [main] INFO http11.Http11Protocol - Initializing Coyote HTTP/1.1 on port 8 080 Starting service Tomcat-Standalone Apache Tomcat/4.1.24 5324 [main] INFO http11.Http11Protocol - Starting Coyote HTTP/1.1 on port 8080 5438 [main] INFO common.ChannelSocket - JK2: ajp13 listening on /0.0.0.0:8009 5440 [main] INFO server.JkMain - Jk running ID=0 time=1/116 config=/usr/java/j akarta-tomcat-4.1.24/conf/jk2.properties 33445 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed So, now there are no exceptions being thrown, but my log message is still going to catalina.out, despite the properties file: log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p %F:%L - %m%n Thanks for all your help. Do you see anything wrong with this? Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j, again
Ceki Gülcü wrote: My suggestion would be to start tomcat and set the log4j.debug property to true. OK, did it: log4j.debug=true log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p %F:%L - %m%n The extra command line argument is -Dlog4j.debug=true Did that too: [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# CATALINA_OPTS=-Dlog4j.debug=true [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# export CATALINA_OPTS [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# rm logs/catalina.out rm: remove regular file `logs/catalina.out'? y [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# bin/startup.sh Using CATALINA_BASE: /usr/java/jakarta-tomcat-4.1.24 Using CATALINA_HOME: /usr/java/jakarta-tomcat-4.1.24 Using CATALINA_TMPDIR: /usr/java/jakarta-tomcat-4.1.24/temp Using JAVA_HOME: /usr/java/j2sdk1.4.1_02 I am using ant to build a war file for my app and deploy it to tomcat. I did a find to locate where tomcat put my log4j.properties file. It put it in: $CATALINA_HOME/work/Standalone/localhost/vendor/WEB-INF/classes/log4j.properties The catalina.out file is a bit too long to just cut and paste easily, so I am attaching the file to this email message. It appears to not be able to find the log4j.properties file and throws an exception. Any more suggestions will be appreciated. Thanks. Dean This should show which configuration file log4j load if it loads one at all. If your config file is found, you should also see log4j parsing it. BTW, your config file looks OK. At 04:56 PM 7/3/2003 -0400, Dean A. Hoover wrote: Sorry about that. It turns out that I had some tags in the web.xml file in the wrong place. I didn't realize that the order of those tags was important. Anyway. I fixed that, but the file logging is still not working. Here is the catalina.out file: 0 [main] INFO modeler.Registry - Loading registry information 2 [main] INFO modeler.Registry - Creating new Registry instance 471 [main] INFO modeler.Registry - Creating MBeanServer 1214 [main] INFO http11.Http11Protocol - Initializing Coyote HTTP/1.1 on port 8 080 Starting service Tomcat-Standalone Apache Tomcat/4.1.24 5324 [main] INFO http11.Http11Protocol - Starting Coyote HTTP/1.1 on port 8080 5438 [main] INFO common.ChannelSocket - JK2: ajp13 listening on /0.0.0.0:8009 5440 [main] INFO server.JkMain - Jk running ID=0 time=1/116 config=/usr/java/j akarta-tomcat-4.1.24/conf/jk2.properties 33445 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed So, now there are no exceptions being thrown, but my log message is still going to catalina.out, despite the properties file: log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p %F:%L - %m%n Thanks for all your help. Do you see anything wrong with this? Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] log4j: Trying to find [log4j.xml] using context classloader StandardClassLoader available: Extension[org.apache.commons.logging, implementationVendor=Apache Software Foundation, implementationVersion=1.0.2, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.digester, implementationVendor=Apache Software Foundation, implementationVersion=1.4.1, specificationVendor=Apache Software Foundation, specificationVersion=1.4] Extension[modeler, implementationVendor=Apache Software Foundation, implementationVersion=1.0, specificationVendor=Apache Software Foundation, specificationVersion=1.0] [EMAIL PROTECTED]@, implementationVendor=Apache Software Foundation, [EMAIL PROTECTED]@, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.beanutils, implementationVendor=Apache Software Foundation, implementationVersion=1.6, specificationVendor=Apache Software Foundation, specificationVersion=1.6] Extension[coyote, implementationVendor=Apache Software Foundation, implementationVersion=1.0-dev, specificationVendor=Apache Software Foundation, specificationVersion=1.0] delegate: true repositories: file:/usr/java/jakarta-tomcat-4.1.24/server/classes/ file:/usr/java/jakarta-tomcat-4.1.24/server/lib/mx4j-jmx.jar
RE: tomcat and log4j, again
Mmmm, for some reason it is using all the right class loaders to attempt to find the log4j.xml file, but it only uses 1 different methods to try to find log4j.properties. That is odd. Is this a Tomcat 4.1 specific class loader issue? What about trying converting your log4j.properties file into a log4j.xml file, and placing it in the same spot. Given the catalina.out is attempting to look for that file in the right spots it should find it. Paul -Original Message- From: Dean A. Hoover [mailto:[EMAIL PROTECTED] Sent: Friday, 4 July 2003 8:37 AM To: Log4J Users List Subject: Re: tomcat and log4j, again Ceki Gülcü wrote: My suggestion would be to start tomcat and set the log4j.debug property to true. OK, did it: log4j.debug=true log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p %F:%L - %m%n The extra command line argument is -Dlog4j.debug=true Did that too: [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# CATALINA_OPTS=-Dlog4j.debug=true [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# export CATALINA_OPTS [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# rm logs/catalina.out rm: remove regular file `logs/catalina.out'? y [EMAIL PROTECTED] jakarta-tomcat-4.1.24]# bin/startup.sh Using CATALINA_BASE: /usr/java/jakarta-tomcat-4.1.24 Using CATALINA_HOME: /usr/java/jakarta-tomcat-4.1.24 Using CATALINA_TMPDIR: /usr/java/jakarta-tomcat-4.1.24/temp Using JAVA_HOME: /usr/java/j2sdk1.4.1_02 I am using ant to build a war file for my app and deploy it to tomcat. I did a find to locate where tomcat put my log4j.properties file. It put it in: $CATALINA_HOME/work/Standalone/localhost/vendor/WEB-INF/classe s/log4j.properties The catalina.out file is a bit too long to just cut and paste easily, so I am attaching the file to this email message. It appears to not be able to find the log4j.properties file and throws an exception. Any more suggestions will be appreciated. Thanks. Dean This should show which configuration file log4j load if it loads one at all. If your config file is found, you should also see log4j parsing it. BTW, your config file looks OK. At 04:56 PM 7/3/2003 -0400, Dean A. Hoover wrote: Sorry about that. It turns out that I had some tags in the web.xml file in the wrong place. I didn't realize that the order of those tags was important. Anyway. I fixed that, but the file logging is still not working. Here is the catalina.out file: 0 [main] INFO modeler.Registry - Loading registry information 2 [main] INFO modeler.Registry - Creating new Registry instance 471 [main] INFO modeler.Registry - Creating MBeanServer 1214 [main] INFO http11.Http11Protocol - Initializing Coyote HTTP/1.1 on port 8 080 Starting service Tomcat-Standalone Apache Tomcat/4.1.24 5324 [main] INFO http11.Http11Protocol - Starting Coyote HTTP/1.1 on port 8080 5438 [main] INFO common.ChannelSocket - JK2: ajp13 listening on /0.0.0.0:8009 5440 [main] INFO server.JkMain - Jk running ID=0 time=1/116 config=/usr/java/j akarta-tomcat-4.1.24/conf/jk2.properties 33445 [Thread-5] WARN common.Vendor - attempt to authenticate 'xxx' failed So, now there are no exceptions being thrown, but my log message is still going to catalina.out, despite the properties file: log4j.logger.fermataintl.migrasponder=DEBUG, l1 log4j.appender.l1=org.apache.log4j.FileAppender log4j.appender.l1.File=/tmp/migrasponder log4j.appender.l1.layout=org.apache.log4j.PatternLayout log4j.appender.l1.layout.ConversionPattern=%d{-MM-dd HH:mm:ss} %-5p %F:%L - %m%n Thanks for all your help. Do you see anything wrong with this? Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - 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: tomcat and log4j, again
At 08:40 AM 7/4/2003 +1000, you wrote: Mmmm, for some reason it is using all the right class loaders to attempt to find the log4j.xml file, but it only uses 1 different methods to try to find log4j.properties. That is odd. Is this a Tomcat 4.1 specific class loader issue? That's probably a cut-n-paste issue. Log4j searches for the log4j.xml file first, but otherwise it searches in the same way as for the log4j.properties file. What about trying converting your log4j.properties file into a log4j.xml file, and placing it in the same spot. Given the catalina.out is attempting to look for that file in the right spots it should find it. Using log4j.properties is fine. No need to convert to log4j.xml on account of initialization. Paul -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j, again
Do you have a copy of the log4j.jar file other than the WEB_INF/lib directory of your web-app? Do you have it in the classpath? In the JVM extensions directory? By the way, tomcat is not starting properly which means that your web-app will also not start but you get log4j messages which mean that there is a copy of log4j.jar in a place other than your web-app's WEB_INF/lib directory. log4j: Trying to find [log4j.xml] using context classloader StandardClassLoader available: Extension[org.apache.commons.logging, implementationVendor=Apache Software Foundation, implementationVersion=1.0.2, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.digester, implementationVendor=Apache Software Foundation, implementationVersion=1.4.1, specificationVendor=Apache Software Foundation, specificationVersion=1.4] Extension[modeler, implementationVendor=Apache Software Foundation, implementationVersion=1.0, specificationVendor=Apache Software Foundation, specificationVersion=1.0] [EMAIL PROTECTED]@, implementationVendor=Apache Software Foundation, [EMAIL PROTECTED]@, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.beanutils, implementationVendor=Apache Software Foundation, implementationVersion=1.6, specificationVendor=Apache Software Foundation, specificationVersion=1.6] Extension[coyote, implementationVendor=Apache Software Foundation, implementationVersion=1.0-dev, specificationVendor=Apache Software Foundation, specificationVersion=1.0] delegate: true repositories: file:/usr/java/jakarta-tomcat-4.1.24/server/classes/ file:/usr/java/jakarta-tomcat-4.1.24/server/lib/mx4j-jmx.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-logging.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-digester.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-invoker.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-manager.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-modeler.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-default.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-http11.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-fileupload-1.0-beta-1.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-util.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/catalina.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-beanutils.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-coyote.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/jaas.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-common.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-webdav.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-warp.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/catalina-ant.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-jk2.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/jakarta-regexp-1.2.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-jk.jar required: -- Parent Classloader: StandardClassLoader available: Extension[javax.mail, implementationVendor=Sun Microsystems, Inc., implementationVendorId=com.sun, implementationVersion=1.2, specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2] Extension[org.apache.commons.logging, implementationVendor=Apache Software Foundation, implementationVersion=1.0.2, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.collections, implementationVendor=Apache Software Foundation, implementationVersion=2.1, specificationVendor=Apache Software Foundation, specificationVersion=2.1] Extension[org.apache.commons.pool, implementationVendor=Apache Software Foundation, implementationVersion=1.0.1, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.dbcp, implementationVendor=Apache Software Foundation, implementationVersion=1.0, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.tools.ant, implementationVendor=Apache Software Foundation, implementationVersion=1.5.1, specificationVendor=Apache Software Foundation, specificationVersion=1.5.1] delegate: true repositories: file:/usr/java/jakarta-tomcat-4.1.24/common/classes/ file:/usr/java/jakarta-tomcat-4.1.24/common/endorsed/xercesImpl.jar file:/usr/java/jakarta-tomcat-4.1.24/common/endorsed/xmlParserAPIs.jar file:/usr/java/jakarta-tomcat-4.1.24/common/lib/servlet.jar file:/usr/java/jakarta-tomcat-4.1.24/common/lib/mail.jar file:/usr/java/jakarta-tomcat-4.1.24/common/lib/commons-logging-api.jar file:/usr/java/jakarta-tomcat-4.1.24/common/lib/commons-collections.jar
Re: tomcat and log4j, again
Ceki Gülcü wrote: At 08:40 AM 7/4/2003 +1000, you wrote: Mmmm, for some reason it is using all the right class loaders to attempt to find the log4j.xml file, but it only uses 1 different methods to try to find log4j.properties. That is odd. Is this a Tomcat 4.1 specific class loader issue? That's probably a cut-n-paste issue. Log4j searches for the log4j.xml file first, but otherwise it searches in the same way as for the log4j.properties file. Not a cut-n-paste issue. I blew away the catalina.out file prior to startup.sh. I then attached the entire file, since it was more than a screenful for cutting and pasting. What you see is what I got. What about trying converting your log4j.properties file into a log4j.xml file, and placing it in the same spot. Given the catalina.out is attempting to look for that file in the right spots it should find it. Using log4j.properties is fine. No need to convert to log4j.xml on account of initialization. Paul -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - 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: tomcat and log4j, again
Ceki Gülcü wrote: Do you have a copy of the log4j.jar file other than the WEB_INF/lib directory of your web-app? I did a find on *log*.jar and found the following: /usr/java/j2sdk1.4.1_02/jre/lib/ext/log4j-1.2.8.jar /usr/java/jakarta-tomcat-4.1.24/server/lib/commons-logging.jar /usr/java/jakarta-tomcat-4.1.24/common/lib/commons-logging-api.jar /usr/java/jakarta-tomcat-4.1.24/work/Standalone/localhost/vendor/WEB-INF/lib/log4j-1.2.8.jar /usr/java/apache-ant-1.6alpha/lib/ant-weblogic.jar /usr/java/apache-ant-1.6alpha/lib/ant-commons-logging.jar /usr/java/apache-ant-1.6alpha/lib/ant-log4j.jar I believe I put the first one in there myself. Will that cause a problem? Do you have it in the classpath? In the JVM extensions directory? By the way, tomcat is not starting properly which means that your web-app will also not start but you get log4j messages which mean that there is a copy of log4j.jar in a place other than your web-app's WEB_INF/lib directory. log4j: Trying to find [log4j.xml] using context classloader StandardClassLoader available: Extension[org.apache.commons.logging, implementationVendor=Apache Software Foundation, implementationVersion=1.0.2, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.digester, implementationVendor=Apache Software Foundation, implementationVersion=1.4.1, specificationVendor=Apache Software Foundation, specificationVersion=1.4] Extension[modeler, implementationVendor=Apache Software Foundation, implementationVersion=1.0, specificationVendor=Apache Software Foundation, specificationVersion=1.0] [EMAIL PROTECTED]@, implementationVendor=Apache Software Foundation, [EMAIL PROTECTED]@, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.beanutils, implementationVendor=Apache Software Foundation, implementationVersion=1.6, specificationVendor=Apache Software Foundation, specificationVersion=1.6] Extension[coyote, implementationVendor=Apache Software Foundation, implementationVersion=1.0-dev, specificationVendor=Apache Software Foundation, specificationVersion=1.0] delegate: true repositories: file:/usr/java/jakarta-tomcat-4.1.24/server/classes/ file:/usr/java/jakarta-tomcat-4.1.24/server/lib/mx4j-jmx.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-logging.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-digester.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-invoker.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-manager.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-modeler.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-default.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-http11.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-fileupload-1.0-beta-1.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-util.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/catalina.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/commons-beanutils.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-coyote.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/jaas.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-common.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/servlets-webdav.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-warp.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/catalina-ant.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-jk2.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/jakarta-regexp-1.2.jar file:/usr/java/jakarta-tomcat-4.1.24/server/lib/tomcat-jk.jar required: -- Parent Classloader: StandardClassLoader available: Extension[javax.mail, implementationVendor=Sun Microsystems, Inc., implementationVendorId=com.sun, implementationVersion=1.2, specificationVendor=Sun Microsystems, Inc., specificationVersion=1.2] Extension[org.apache.commons.logging, implementationVendor=Apache Software Foundation, implementationVersion=1.0.2, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.collections, implementationVendor=Apache Software Foundation, implementationVersion=2.1, specificationVendor=Apache Software Foundation, specificationVersion=2.1] Extension[org.apache.commons.pool, implementationVendor=Apache Software Foundation, implementationVersion=1.0.1, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.commons.dbcp, implementationVendor=Apache Software Foundation, implementationVersion=1.0, specificationVendor=Apache Software Foundation, specificationVersion=1.0] Extension[org.apache.tools.ant, implementationVendor=Apache Software Foundation, implementationVersion=1.5.1, specificationVendor=Apache Software Foundation,