Re: How do I set up logging with Tapestry 5 and Tomcat?
This is where I'm at. It's not working. I have a log4j.properties file in tomcat/conf which has these lines: log4j.appender.tomcat = org.apache.log4j.RollingFileAppender log4j.appender.tomcat.File = ${catalina.base}/logs/tomcat.log log4j.appender.tomcat.MaxFileSize = 10MB log4j.appender.tomcat.MaxBackupIndex = 10 log4j.appender.tomcat.layout = org.apache.log4j.PatternLayout log4j.appender.tomcat.layout.ConversionPattern = %p %t %c - %m%n log4j.rootLogger = INFO, tomcat Then I have another log4j.properties in my WEB-INF/classes folder with these lines: log4j.appender.console = org.apache.log4j.ConsoleAppender log4j.appender.console.layout = org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern = %p %t %c - %m%n log4j.logger.myapp = DEBUG, console All my page and other packages begin with myapp. When I try to log something using info, it does show up in the tomcat.log file. However, it does not show up on the console like I would like it to. When I moved the lines from that file into the tomcat/conf/log4j.properties file, it all worked fine. So basically, my WEB-INDF/classes/log4j.properties file is being ignored. Why is my log4j.properties file being ignored? I even have its location specified in my web.xml file. What's going on? Thanks. -- Tim Koop mailto:t...@timkoop.com On 16/04/2010 3:05 PM, Peter Stavrinides wrote: You need a log4j.properties file in $CATALINA_HOME/lib Or in the classes directory at runtime... to ensure its always in the right place simply put the log4j.properties or log4j.xml file is in the src/main/resources root folder. regards, Peter
Re: How do I set up logging with Tapestry 5 and Tomcat?
I generally base my log4j.properties from the tapestry quickstart archetype... replace ${package} with your app package (com.yourcompany.yourapp) Maybe this will help. You might try using the quickstart to create a simple project and see if the logging works with the rest of your environment, sometimes it helps to have something that works to compare. # Default to info level output; this is very handy if you eventually use Hibernate as well. log4j.rootCategory=info, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%p] %c{2} %m%n # Service category names are the name of the defining module class # and then the service id. log4j.category.${package}.services.AppModule.TimingFilter=info # Outputs a list of pages, components and mixins at startup. log4j.category.org.apache.tapestry5.services.TapestryModule.ComponentClassResolver=info # Outputs startup statistics; elapsed time to setup and initialize the registry, and a list of # available services. log4j.category.org.apache.tapestry5.TapestryFilter=info # Turning on debug mode for a page's or component's transformer logger # will show all of the code changes that occur when the # class is loaded. # log4j.category.tapestry.transformer.${package}.pages.Index=debug # Turning on debug mode for a component's events logger will show all the events triggered on the # component, and which component methods are invoked as a result. # log4j.category.tapestry.events.${package}.pages.Index=debug # Turning on trace mode for a page's render logger provides extended information about every step # in rendering (this is not generally helpful). Turning on debug mode will add a one-line # summary that includes the elapsed render time, which can be useful in tracking down # performance issues. # log4j.category.tapestry.render.${package}.pages.Index=debug # Turn on some verbose debugging about everything in the application. This is nice initially, # while getting everything set up. You'll probably want to remove this once you are # up and running, replacing it with more selective debugging output. log4j.category.${package}=debug On Wed, Apr 28, 2010 at 9:57 AM, Tim Koop t...@timkoop.com wrote: This is where I'm at. It's not working. I have a log4j.properties file in tomcat/conf which has these lines: log4j.appender.tomcat = org.apache.log4j.RollingFileAppender log4j.appender.tomcat.File = ${catalina.base}/logs/tomcat.log log4j.appender.tomcat.MaxFileSize = 10MB log4j.appender.tomcat.MaxBackupIndex = 10 log4j.appender.tomcat.layout = org.apache.log4j.PatternLayout log4j.appender.tomcat.layout.ConversionPattern = %p %t %c - %m%n log4j.rootLogger = INFO, tomcat Then I have another log4j.properties in my WEB-INF/classes folder with these lines: log4j.appender.console = org.apache.log4j.ConsoleAppender log4j.appender.console.layout = org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern = %p %t %c - %m%n log4j.logger.myapp = DEBUG, console All my page and other packages begin with myapp. When I try to log something using info, it does show up in the tomcat.log file. However, it does not show up on the console like I would like it to. When I moved the lines from that file into the tomcat/conf/log4j.properties file, it all worked fine. So basically, my WEB-INDF/classes/log4j.properties file is being ignored. Why is my log4j.properties file being ignored? I even have its location specified in my web.xml file. What's going on? Thanks. -- Tim Koop mailto:t...@timkoop.com On 16/04/2010 3:05 PM, Peter Stavrinides wrote: You need a log4j.properties file in $CATALINA_HOME/lib Or in the classes directory at runtime... to ensure its always in the right place simply put the log4j.properties or log4j.xml file is in the src/main/resources root folder. regards, Peter -- -- http://www.bodylabgym.com - a private, by appointment only, one-on-one health and fitness facility. -- http://www.ectransition.com - Quality Electronic Cigarettes at a reasonable price! -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How do I set up logging with Tapestry 5 and Tomcat?
You need a log4j.properties file in $CATALINA_HOME/lib Or in the classes directory at runtime... to ensure its always in the right place simply put the log4j.properties or log4j.xml file is in the src/main/resources root folder. regards, Peter - Original Message - From: Tim Koop t...@timkoop.com To: Tapestry users users@tapestry.apache.org Sent: Thursday, 15 April, 2010 17:01:19 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: How do I set up logging with Tapestry 5 and Tomcat? Good question. I don't know the answer. It might have something to do with the fact that I put all my Tapestry jars in a common Tomcat lib directory. It might be different if you put them all in your application's lib directory. That way log4j would only start looking for log4j.properties when your application starts, not with Tomcat starts. And it might find it in your WEB-INF/classes directory. Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com On 15/04/2010 2:36 AM, Ivano Luberti wrote: But if I deploy on a server I cannot control how can I tune my logging? Il 14/04/2010 23.06, Tim Koop ha scritto: To answer my own question, the answer is this: You need a log4j.properties file in $CATALINA_HOME/lib, as this page describes: http://tomcat.apache.org/tomcat-6.0-doc/logging.html As soon as that file was there, my own log4j.properties in my classes folder started to be used. Just a guess, but I guess that the missing file in Tomcat's directory caused an irrecoverable error with log4j (I did have a log4j error in the Tomcat startup script), so nothing else worked after that. But now it all works fine. Tim Koop t...@timkoop.commailto:t...@timkoop.com www.timkoop.comhttp://www.timkoop.com On 14/04/2010 12:07 PM, Tim Koop wrote: Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How do I set up logging with Tapestry 5 and Tomcat?
But if I deploy on a server I cannot control how can I tune my logging? Il 14/04/2010 23.06, Tim Koop ha scritto: To answer my own question, the answer is this: You need a log4j.properties file in $CATALINA_HOME/lib, as this page describes: http://tomcat.apache.org/tomcat-6.0-doc/logging.html As soon as that file was there, my own log4j.properties in my classes folder started to be used. Just a guess, but I guess that the missing file in Tomcat's directory caused an irrecoverable error with log4j (I did have a log4j error in the Tomcat startup script), so nothing else worked after that. But now it all works fine. Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com On 14/04/2010 12:07 PM, Tim Koop wrote: Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance. -- == dott. Ivano Mario Luberti Archimede Informatica societa' cooperativa a r. l. Sede Operativa Via Gereschi 36 - 56126- Pisa tel.: +39-050- 580959 tel/fax: +39-050-9711344 web: www.archicoop.it == - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How do I set up logging with Tapestry 5 and Tomcat?
Good question. I don't know the answer. It might have something to do with the fact that I put all my Tapestry jars in a common Tomcat lib directory. It might be different if you put them all in your application's lib directory. That way log4j would only start looking for log4j.properties when your application starts, not with Tomcat starts. And it might find it in your WEB-INF/classes directory. Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com On 15/04/2010 2:36 AM, Ivano Luberti wrote: But if I deploy on a server I cannot control how can I tune my logging? Il 14/04/2010 23.06, Tim Koop ha scritto: To answer my own question, the answer is this: You need a log4j.properties file in $CATALINA_HOME/lib, as this page describes: http://tomcat.apache.org/tomcat-6.0-doc/logging.html As soon as that file was there, my own log4j.properties in my classes folder started to be used. Just a guess, but I guess that the missing file in Tomcat's directory caused an irrecoverable error with log4j (I did have a log4j error in the Tomcat startup script), so nothing else worked after that. But now it all works fine. Tim Koop t...@timkoop.commailto:t...@timkoop.com www.timkoop.comhttp://www.timkoop.com On 14/04/2010 12:07 PM, Tim Koop wrote: Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance.
How do I set up logging with Tapestry 5 and Tomcat?
Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance. -- Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com
Re: How do I set up logging with Tapestry 5 and Tomcat?
Tapestry logs with slf4j. You need the slf4j - log4j - bridge. Make sure log4j-over-slf4j.jar is in the classpath. On Wed, Apr 14, 2010 at 7:07 PM, Tim Koop t...@timkoop.com wrote: Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance. -- Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com -- Best regards, Igor Drobiazko http://tapestry5.de/blog
Re: How do I set up logging with Tapestry 5 and Tomcat?
Thanks Igor. I just checked, and there are dozens of jar files in the class path, including slf4j-api-1.5.2.jar, slf4j-log4j12-1.5.2.jar, and log4j-1.2.14.jar. Come to think of it, I don't have any need to specifically use log4j at all. If someone can tell me how to get logging to work with slf4j, I would be happy with that. Thanks. Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com On 14/04/2010 1:52 PM, Igor Drobiazko wrote: Tapestry logs with slf4j. You need the slf4j - log4j - bridge. Make sure log4j-over-slf4j.jar is in the classpath. On Wed, Apr 14, 2010 at 7:07 PM, Tim Koopt...@timkoop.com wrote: Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance. -- Tim Koop t...@timkoop.commailto:t...@timkoop.com www.timkoop.comhttp://www.timkoop.com
Re: How do I set up logging with Tapestry 5 and Tomcat?
To answer my own question, the answer is this: You need a log4j.properties file in $CATALINA_HOME/lib, as this page describes: http://tomcat.apache.org/tomcat-6.0-doc/logging.html As soon as that file was there, my own log4j.properties in my classes folder started to be used. Just a guess, but I guess that the missing file in Tomcat's directory caused an irrecoverable error with log4j (I did have a log4j error in the Tomcat startup script), so nothing else worked after that. But now it all works fine. Tim Koop t...@timkoop.com mailto:t...@timkoop.com www.timkoop.com http://www.timkoop.com On 14/04/2010 12:07 PM, Tim Koop wrote: Hi everyone. I've been using Tapestry 5 for a while. I like it, but I can't seem to get logging working. In my page java class I have this: @Inject private Logger log; Object onSuccess() { log.debug(Tim was here.); return null; } This compiles and runs. I would like to see that message in a log file somewhere, but I can't find it anywhere. I've looked through Tomcat's logs (catalina, hiost-manager, and manager), and I've looked on the console that I started Tomcat from, but I can't find it. I'm not using the Maven setup. Apparently it makes a log4j.properties file somewhere. I tried making one and I put it in my WEB-INF/classes folder. I also tried putting it in WEB-INF/. Neither seemed to work. The contents of my log4j.properties file is this: log4j.rootLogger=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:\\work\\tomcat\\logs\\timslogfile.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.apache.catalina=ERROR, R Does anyone have any ideas? I'm out of ideas. Thanks in advance.