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.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.

Reply via email to