隐藏 HttpClient 在console的日志

java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST);
java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "ERROR");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "ERROR");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "ERROR");

15:52:08.583 [main] DEBUG o.a.h.i.conn.SingleClientConnManager - Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@17a8a02
15:52:08.586 [main] DEBUG o.a.h.i.conn.SingleClientConnManager - Get connection for route HttpRoute[{}->http://432.1356.1245.137:83080]
15:52:08.587 [main] DEBUG o.a.h.i.c.DefaultClientConnectionOperator - Connecting to /32.153.15.7:80
15:52:08.657 [main] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: best-match
15:52:08.657 [main] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the context
15:52:08.658 [main] DEBUG o.a.h.impl.client.DefaultHttpClient - Attempt 1 to execute request

15:52:08.658 [main] DEBUG org.apache.http.wire - >>

15:52:08.658 [main] DEBUG org.apache.http.headers - >>

原文地址:https://www.cnblogs.com/feelgood/p/4745427.html