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.
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.
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.
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.