如何禁用Http类的LogCat输出

时间:2013-04-05 08:36:46

标签: android http logcat

我正在使用Http类来制作大量的GET / POST请求并在LogCat中获得大量垃圾邮件:

04-05 10:26:21.662: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.max-redirects': null
04-05 10:26:21.662: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.route.forced-route': null
04-05 10:26:21.662: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.route.local-address': null
04-05 10:26:21.662: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.route.default-proxy': null
04-05 10:26:21.662: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.conn-manager.timeout': null
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager(6644): ThreadSafeClientConnManager.getConnection: HttpRoute[{}->http://<ADDRESS>], timeout = 0
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ConnPoolByRoute(6644): Total connections kept alive: 0
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ConnPoolByRoute(6644): Total issued connections: 0
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ConnPoolByRoute(6644): Total allocated connection: 0 out of 20
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ConnPoolByRoute(6644): No free connections [HttpRoute[{}-><ADDRESS>]][null]
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ConnPoolByRoute(6644): Available capacity: 2 out of 2 [HttpRoute[{}-><ADDRESS>]][null]
04-05 10:26:21.662: I/org.apache.http.impl.conn.tsccm.ConnPoolByRoute(6644): Creating new connection [HttpRoute[{}-><ADDRESS>]]
04-05 10:26:21.662: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.connection.stalecheck': null
04-05 10:26:21.672: I/org.apache.http.impl.client.DefaultRequestDirector(6644): Stale connection check
04-05 10:26:21.672: I/org.apache.http.impl.client.DefaultRequestDirector(6644): Stale connection detected
04-05 10:26:21.672: I/org.apache.http.impl.conn.DefaultClientConnection(6644): Connection closed
04-05 10:26:21.672: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.connection.timeout': 10000
04-05 10:26:21.882: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.tcp.nodelay': null
04-05 10:26:21.882: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.socket.timeout': 15000
04-05 10:26:21.892: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.socket.linger': null
04-05 10:26:21.892: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.socket.buffer-size': null
04-05 10:26:21.892: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.element-charset': null
04-05 10:26:21.902: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.connection.max-line-length': null
04-05 10:26:21.902: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.element-charset': null
04-05 10:26:21.902: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.connection.max-header-count': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.connection.max-line-length': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.connection.max-status-line-garbage': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.virtual-host': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.default-headers': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.version': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.useragent': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.version': null
04-05 10:26:21.912: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.expect-continue': false
04-05 10:26:21.922: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.cookie-policy': null
04-05 10:26:21.922: I/org.apache.http.client.protocol.RequestAddCookies(6644): CookieSpec selected: best-match
04-05 10:26:21.922: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.cookie-datepatterns': null
04-05 10:26:21.922: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.single-cookie-header': null
04-05 10:26:21.922: I/org.apache.http.impl.client.DefaultRequestDirector(6644): Attempt 1 to execute request
04-05 10:26:21.922: I/org.apache.http.impl.client.ClientParamsStack(6644): 'http.protocol.version': null
04-05 10:26:21.922: I/org.apache.http.wire(6644): >> "POST /aap.do HTTP/1.1[EOL]"
04-05 10:26:21.922: I/org.apache.http.wire(6644): >> "Content-Length: 567[EOL]"
04-05 10:26:21.932: I/org.apache.http.wire(6644): >> "Content-Type: application/octet-stream[EOL]"
04-05 10:26:21.932: I/org.apache.http.wire(6644): >> "Host: <ADDRESS>[EOL]"
04-05 10:26:21.932: I/org.apache.http.wire(6644): >> "Connection: Keep-Alive[EOL]"
04-05 10:26:21.932: I/org.apache.http.wire(6644): >> "[EOL]"
(...)

我浏览了整个网络,无法相信没有人真的发布了禁用此功能的方法!任何人吗?

修改

为了说清楚 - 我知道我可以在发布等过程中通过ProGuard过滤/删除它 - 我想要做的就是在开发过程中摆脱(而不是过滤)这些日志。

1 个答案:

答案 0 :(得分:0)

Logger.getLogger( “org.apache.http.wire”)setLevel(Level.OFF)。 Logger.getLogger( “”)setLevel(Level.OFF);

有关详细信息,请参阅How to enable logging for apache commons HttpClient on Android