Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error logging in Tomcat 5.5

 
Charles McGuire
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm struggling to understand error logging in 5.5. As per the instructions at http://tomcat.apache.org/tomcat-5.5-doc/logging.html, I've configured my log4j properties file and set up the log4j.jar and commons-logging-1.1.jar files in the common\lib.

The logging seems to work fine. I can switch the log levels from WARN to DEBUG and vary the granularity of the messages. I can see the messages on startup and shutdown.

For example, whenever I type anything into my browser, I can't see any result in the logs. A simple .html page is served up fine, but a 405 error message (HTTP method GET is not supported by this URL) that displays to the screen cannot be found anywhere in the logs. (I'm working on an XML-RPC project).

1) Is there a good resource on Tomcat J2EE development that you can recommend? I'd hate to abuse these boards with newbie problems.

2) As long as I'm posting, does anyone have any suggestions for me for logging? I'd like to see all requests in a log someplace. My log4j.properties file that is in my common\classes folder is as follows:


Thank you...!
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't configured log4j in tomcat, but here are a few links I found. Search for tomcat in the links for more info:

http://logging.apache.org/log4j/docs/manual.html
http://tomcat.apache.org/faq/logging.html#commonsLoggingConfiguration
 
Charles McGuire
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the links, but I already tried those.

Since my post, I discovered that what I want is something called the Valve Component. Click on Tomcat 5.5 Valve Component for reference, but I need it broken down and explained to me like a two year old.

I ordered a Tomcat 5.5 book - should arrive today - that I'm hoping will help me with these issues.

Thanks again for your post.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My next release of jamon will come with a valve that tracks statistics for tomcat. They are pretty easy to write. Essentially one method that intercepts all page requests that go to tomcat. With this you can track the error code, page performance etc or log things. Here is my code. Note they changed the way valves work from tomcat 5 to 5.5.

You wrap the code you want to do around this code.


Here is a sample



[ September 05, 2007: Message edited by: steve souza ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic