-
1. Re: Logging stacktraces from tomcat
starksm64 Mar 25, 2004 11:19 AM (in response to ahardy66)This means the code generating the printStackTrace() output is doing a System.out.println() for everyline in the trace. It needs to be emitted as a single string in one System.out/err println.
-
2. Re: Logging stacktraces from tomcat
ahardy66 Mar 25, 2004 2:18 PM (in response to ahardy66)
Any idea why it would be doing that? It is just my normal error handling in my servlet. Running under standalone tomcat, exception.printStackTrace() has never done this.
The standard-out from JBoss-tomcat is obviously being funnelled through a log4j logger somehow - hence the INFO level - but which logger would it be?
If there is no other option, could I configure a different formatter for it?
Also of course, JBoss shouldn't be assigning it a log4j level at all really - if that is possible.
Adam -
3. Re: Logging stacktraces from tomcat
ahardy66 Mar 29, 2004 2:33 AM (in response to ahardy66)
I don't know what it is that is causing log4j to wrap the stacktraces from tomcat, presumably it's something in the tomcat - jboss integration. I'd love to know - anyone from JBoss?
Anyway the solution is to adjust the log4j configuration. It means taking the appenders off the root category and putting them individually on the subcategories, including 2 categories called STDOUT and STDERR.
I defined a basic layout pattern for STDOUT and STDERR so that there is no extraneous output attached to each statement.
You have to take the console appender off the root category though, which is a bit of a pain, so that STDOUT and STDERR don't print twice.
Creating an "org" category and a "tomcat.localhost" category is a suitable way of assigning an appender to all other categories. -
4. Re: Logging stacktraces from tomcat
starksm64 Mar 29, 2004 9:50 AM (in response to ahardy66)We redirect System.out, System.err to a log4j appender. If you don't want that behavior set the org.jboss.logging.Log4jService.catchSystemOut and org.jboss.logging.Log4jService.catchSystemErr system properties to false.
-
5. Re: Logging stacktraces from tomcat
ahardy66 Mar 30, 2004 4:35 AM (in response to ahardy66)Thanks