I have a Tomcat instance running several websites. Recently I've been trying to deal with the various error messages that wind up in the Tomcat log file (catalina.out). None of the issues are affecting the websites, but all the noise is making it difficult to see actual problems.

My problem is that frequently the message is being emitted by a library that is used by multiple webapps. Unless a stacktrace is included (which it often isn't) I can't tell which webapp is responsible without a lot of digging.

So the question is, can I somehow configure Tomcat to include the servlet context in the log file? Or perhaps have different log files per context?


you have different options:

  • create a tomcat instance for each webapp and configure logging for each instance
  • use log4j and create different logfiles for each context
  • you could do the same with commons-logging

here is the documentation for log4j and commons-logging with an example for context-specific logging and here is a short how-to for multiple instances.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.