Jan 9th, 2009, 11:33 AM
System.out disappearing from MultiActionController
I've been battling with a logging problem for some time and it's very bizarre. I've got a Spring WebMVC app (2.5.6) deployed in Tomcat 5.5.27. I've made no modifications to Tomcat - it's out of the box.
So I started with a MultiActionController that did this:
And discovered log4j wasn't printing out the log statement. I was getting the log4k instance through slf4j, so I switched back to commons logging and that didn't fix the problem. I then wrote a jsp that did nothing more than this:
*org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Object.class);
*log.info("moo via logger from jsp");
And it works correctly - I can see the log statement appear in the logs. So I put a System.out.println() in the MultiActionController, and that didn't work either! However it works in the JSP. So the log framework is definitely working. I therefore wrote a HelloWorld servlet, defined it in web.xml, and did nothing more than write to the logger and System.out - it works.
Therefore, I find myself in a situation where a System.out, servletContext.log and logger.info is ignored when the source is within a Spring MVC bean (i.e. an extension of MultiActionController).
Jan 9th, 2009, 12:00 PM
Wonderful. A third party API I'm using is playing with Standard Out. Panic over