Spring mvc jackson: log data
jackson, spring-mvc
Solution
A good place to start looking into the marshalling process is `AbstractMessageConverterMethodProcessor.writeWithMessageConverters` - that will give you a good overview of what's being executed.
As for the logging aspect, the first `catch` of the entire marshalling/unmarshalling process is `ServletInvocableHandlerMethod.invokeAndHandle`:
catch (Exception ex) {
if (logger.isTraceEnabled()) {
logger.trace(getReturnValueHandlingErrorMessage("Error handling return value", returnValue), ex);
}
throw ex;
}
So - enabling `TRACE` in your logging configuration here - on `org.springframework.web.servlet.mvc.method.annotation` will give you the info you need.
Further on, another good place to catch this kind of logging output - this time with `DEBUG` instead of `TRACE` is: `DispatcherServlet.processHandlerException`.
Hope this helps.
Problem
I have a question regardimg spring mvc and jackson mapper: every time I call a rest service passing a wrong json (empty, wron params,...) the client correctly receives an error, but there is no way to see in detail the call on server side. Is there a way to log in a proper way this information? Thanks in advance for the help. Fabio