How do I get spring-ws + tomcat to log errors
I'm creating a Spring-WS based webservice and running it in tomcat. I made some change and now get a fault with OperationUnsupportedException.
I'd like to see the entire stack trace that Spring-WS is getting, but cannot figure out how to have it logged.
Does anybo开发者_如何学Gody know how to have this stack trace logged somewhere?
If you add a log4j.properties file to the root of your source folder with the following settings:
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-5p [%c] - <%m>%n
log4j.logger.package.name.that.you.are.interested.in=DEBUG
log4j.logger.org.springframework=ERROR
Then the stacktrace should be printed in the terminal window you started the application from.
Updated
That's good you found a solution with log4j.
But if you're relatively new to log4j, I will recommend you to take a look at SLF4J framework. I have written about how to route log messages from Apache Commons Logging and log4J to SLF4J here. (Tomcat and Spring logs with Apache Commons Logging)
精彩评论