如何禁用Restlet 2.0中的日志记录? [英] How can I disable logging in Restlet 2.0?

查看:156
本文介绍了如何禁用Restlet 2.0中的日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在我的项目中禁用Restlet的日志到stdout/stderr,并通过org.restlet.ext.slf4j提供的SLF4J外观转发所有Restlet日志.是否有捷径可寻?

I simply want to disable Restlet's logging to stdout/stderr in my project and forward all Restlet logging through the SLF4J facade provided by org.restlet.ext.slf4j. Is there an easy way to do this?

推荐答案

您首先必须配置SLF4J来拦截Restlet对java.util.logging API的所有调用,并将它们映射到SLF4J Facade的API上的调用.您只需将 jul-to-slf4j.jar 放在@Bruno中,即可完成此操作注意.

You first must configure SLF4J to intercept all of Restlet's calls to the java.util.logging APIs and map them into calls on the SLF4J facade's APIs instead. You simply do this by putting jul-to-slf4j.jar in your classpath, as @Bruno noted.

第二,您必须配置SLF4J外观以将其API调用转发到日志记录实现,以进行实际的日志消息生成.要使用Logback日志记录实现,请将 logback-classic.jar 放入类路径

Second, you have to configure the SLF4J facade to forward its API calls on to a logging implementation to do the actual log message generation. To use the Logback logging implementation, you drop logback-classic.jar into your classpath

最后,您必须配置所选的日志记录实现.如果您使用的是Logback,则可以使用XML调整单个Logger的日志记录级别

Finally, you have to configure your selected logging implementation. If you're using Logback, you can adjust the logging level of individual Loggers using XML.

我们将SLF4J与Restlet一起使用,并且真的很喜欢SLF4J如何将所有不同的日志记录API统一为一个.很好.

We're using SLF4J with Restlet, and really like how SLF4J unifies all the different logging APIs into one. It's very nice.

2019年4月29日请务必查看@NaftuliKay和@stempler的评论,Restlet无疑在过去十年中发生了变化!

Edit 29 April 2019: Be sure to check the comments from @NaftuliKay and @stempler, Restlet has doubtless changed over the last decade!

这篇关于如何禁用Restlet 2.0中的日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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