javajacksonjava.util.loggingtcserver

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


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


Solution

  • 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!