14

I am trying to deserialize incoming PUT request with JSON request body using org.codehaus.jackson package and I am receiving error message The request sent by the client was syntactically incorrect. How can I get more detailed log/error messages in my Pivotal TC server logs, e.g. in catalina.log?

I have added the following line to logging.properties:

org.codehaus.level = FINEST

But NO messages from org.codehaus is displayed in my log, although the error message is displayed on web page. Maybe codehaus does not support Java logging and I should configure J4Log or similar another logging facility?

My Jackson version is 1.9.13, I am using Pivotal tc server from Spring Tools Suite (3.8).

Naman
  • 23,555
  • 22
  • 173
  • 290
TomR
  • 2,107
  • 5
  • 27
  • 48

2 Answers2

6

For what you say it seems that you're trying to change the tomcat logging.properties.

That's usually a bad idea as you may want different logging on different webApps loaded in the same Tomcat server.

What you should do is configure the log4j in your project. Usually Java projects define a "resource" folder. You should add in there a file called

log4j.properties

and add in there the following:

log4j.rootLogger=ERROR,stdout
# Logger for jackson lib
log4j.logger.org.codehaus=TRACE

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n

This is extracted from the default log4j configuration and will log in the standard output that for Tomcat is redirected to the catalina.out log file. You may want to read the documentation at https://docs.oracle.com/cd/E29578_01/webhelp/cas_webcrawler/src/cwcg_config_log4j_file.html explaining how to redirect the logging to a different file and how to use rolling appenders so you keep some history

Hopefully this will work!

gmcontessa
  • 538
  • 3
  • 10
3

The request sent by the client was syntactically incorrect

^^^ This message is created by the HTTP servlet processing the client request and not by the jackson mapper. You could find the related log messages under spring-mvc logger name: org.springframework.web

HTH

Steve Oh
  • 989
  • 8
  • 18