如何查看org.codehaus.jackson日志消息-使用logging.properties [英] How to see org.codehaus.jackson log messages - using logging.properties

查看:87
本文介绍了如何查看org.codehaus.jackson日志消息-使用logging.properties的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用org.codehaus.jackson包使用JSON请求正文反序列化传入的 PUT 请求,并且收到错误消息The request sent by the client was syntactically incorrect.如何在我的Pivotal TC服务器日志中获取更详细的日志/错误消息,例如在catalina.log中?

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?

我已将以下行添加到logging.properties:

I have added the following line to logging.properties:

org.codehaus.level = FINEST

但是来自org.codehaus NO 消息显示在我的日志中,尽管错误消息显示在网页上.也许codehaus不支持Java日志记录,我应该配置J4Log或类似的其他日志记录工具吗?

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?

我的 Jackson版本是1.9.13 ,我正在使用 Spring Tools Suite(3.8) 中的Pivotal tc服务器strong>.

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

推荐答案

对于您所说的,似乎您正在尝试更改tomcat logging.properties.

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

通常这是一个坏主意,因为您可能希望在同一台Tomcat服务器中加载的不同webApp上进行不同的登录.

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

您应该做的是在项目中配置log4j. 通常,Java项目定义一个资源"文件夹.您应该在其中添加一个名为

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

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

这是从默认的log4j配置中提取的,并将登录到Tomcat的标准输出,该输出已重定向到catalina.out日志文件. 您可能需要阅读 https://docs.oracle .com/cd/E29578_01/webhelp/cas_webcrawler/src/cwcg_config_log4j_file.html 解释了如何将日志记录重定向到其他文件,以及如何使用滚动追加程序,以便保留一些历史记录

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

希望这会起作用!

这篇关于如何查看org.codehaus.jackson日志消息-使用logging.properties的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆