How to get hold of the (un)marshalled message for logging
I have a Spring MVC REST service that uses XStream to convert the messages to and from XML.
开发者_如何学PythonIs there any way I can print the xml (ie the body) from the request and response to a normal log4j logger?
Inside the controller won't work cause by then XStream has alread unmarshalled the request and not yet marshalled the response.
A filter in the servlet isn't very nice either as it will consume the body by reading it.
And thats where I run out if ideas. So, SO? Any takers? :)
You can use an interceptor to log your request and response content coming to your specific rest uri's - More details here
精彩评论