如何关闭Netty库调试输出? [英] How to turn off Netty library debug output?

查看:657
本文介绍了如何关闭Netty库调试输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Netty(通过Ning async HTTP library )通过HTTP检索文档。这会产生大量的调试输出控制台,如下面列出的单个文档请求。

I am using Netty (via the Ning async HTTP library) to retrieve documents via HTTP. This produces a huge amount of debug output the console, as listed below for a single document request.

任何人都知道如何关闭它?我真的不需要看到这个输出。

Anyone know how to turn this off? I really don't need to see this output.

我正在从Scala打电话,如果这有任何区别。

I'm calling from Scala, if that makes any difference.

15:07:14.273 [run-main] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - 
Non cached request 
DefaultHttpRequest(chunked: false)
GET /api/search.json?q=foo HTTP/1.1
Host: www.documentcloud.org
Connection: keep-alive
Accept: */*
User-Agent: NING/1.0

using Channel 
[id: 0x2839ca40]

15:07:14.930 [New I/O client worker #1-1] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - 

Request DefaultHttpRequest(chunked: false)
GET /api/search.json?q=foo HTTP/1.1
Host: www.documentcloud.org
Connection: keep-alive
Accept: */*
User-Agent: NING/1.0

Response DefaultHttpResponse(chunked: true)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 10477
Connection: keep-alive
Vary: Accept-Encoding
Status: 200
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.13
ETag: "4f8f766d639dd84d014dfee3abb45de2"
X-Runtime: 611
Cache-Control: private, max-age=0, must-revalidate
Server: nginx/1.2.1 + Phusion Passenger 3.0.13 (mod_rails/mod_rack)

15:07:14.941 [New I/O client worker #1-1] DEBUG c.n.h.c.p.netty.NettyConnectionsPool - Adding uri: http://www.documentcloud.org:80 for channel [id: 0x2839ca40, /10.5.165.61:56133 => www.documentcloud.org/75.101.159.206:80]

15:07:16.921 [New I/O client worker #1-1] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - Channel Closed: [id: 0x2839ca40, /10.5.165.61:56133 :> www.documentcloud.org/75.101.159.206:80] with attachment com.ning.http.client.providers.netty.NettyAsyncHttpProvider$DiscardEvent@63182c3d
15:08:13.924 [Timer-0] DEBUG c.n.h.c.p.netty.NettyConnectionsPool - Entry count for : http://www.documentcloud.org:80 : 0


推荐答案

通过缩写的包名来判断,似乎我在这里使用slf4j / logback进行日志记录。在这种情况下,
只是尝试在类路径中包含一个logback.xml配置文件。

judging by the abbreviated package names seems to me slf4j/logback is being used for logging here. in that case just try including a logback.xml configuration file in your classpath. something along the lines of

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="STDOUT"/>
    </root>

    <logger name="com.ning.http.client" level="WARN"/>
</configuration>

上面的xml会导致com.ning.http.client(及向下)下的任何内容只能省略警告,输出更糟糕,将输出到system.out。其他任何东西都会遗漏INFO +
你可以在这里找到有关配置logback的更多信息: http://logback.qos.ch /manual/configuration.html

the above xml would cause anything under com.ning.http.client (and downwards) to omit only warnings and worse to the output, which will be streamed to system.out. anything else will ommit INFO+ you can find more information on configuring logback here: http://logback.qos.ch/manual/configuration.html

这篇关于如何关闭Netty库调试输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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