Debugging Tomcat WAR


I hope would have found a step by step guide for debugging a tomcat WAR at runtime. Unfortunately the documentation sucks, I mean really, you expect people to go through pages of tutorials to understand debugging. Why cant it just be a few steps. Anyway, I figured some of the crap out, and am documenting it here for my reference. If you like to add more points please comment.

catalina.out, gives out errors but really cryptic shit. Unbelieveable that a out file would only give something as stupid as “SEVERE: ERROR LISTENERSTART” AND “SEVERE: ERROR FILTERSTART”. This happens when an exception is thrown in the contextInitialized method of a ServletContextListener. For this all I had to do was create a new file in /var/lib/tomcat7/webapps/MY_APP/WEB_INF/classes folder. In this file I added these 2 lines for getting a stack trace on catalina.out.

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

More is coming here…