When my Model catches an exception then re-throws it to the Controller which calls printStackTrace() , the Apache-Tomcat logs do not record where the Model had the problem . Can AT be configured to write printStackTrace() to the logs?
I know that I can put printStackTrace (PrintStream) into a String and log() that String (the String has all that I require) , but do I need to do this ?
Apache Tomcat typically writes anything from STDOUT to logs/catalina.out .
My personal preference for logging is Apache log4j - http://logging.apache.org/log4j/ . Logging is all controlled by a properties file, allowing you to easily change logging levels and appenders (log files) without touching your java code. Each logging method can take a message and/or an optional Exception, which will give you similar output to calling Exception.printStackTrace().
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Joined: Apr 16, 2004
Peter : I think Log4J is really for continuous monitoring and logging of events.
Bill's solution gives the same results and is simpler than the one I mentioned.
Thank you both.