How to see org.codehaus.jackson log messages - using logging.properties
Asked Answered
M

2

15

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).

Manure answered 14/8, 2017 at 12:54 Comment(4)
log4j.logger.org.springframework.web=debug could do the trick.Lophobranch
And in which config file should I write this? I guess there is separate file for log4j?Manure
There should be. I'm not familiar with your setup.Lophobranch
@Manure could you share your logging.properties for better idea of how you;re configuring it currently.Goglet
B
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!

Bacardi answered 17/8, 2017 at 20:21 Comment(0)
O
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.

Outlive answered 22/8, 2017 at 8:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.