2 jeson5k jeson5k 于 2014.01.03 09:49 提问

日志是INFO级别 httpclient 控制台还是打印很多信息。怎么关闭

[14/01/03 09:42:53:942][org.apache.commons.httpclient.HttpClient-] Java version: 1.6.0_37
[14/01/03 09:42:53:973][org.apache.commons.httpclient.HttpClient-] Java vendor: Sun Microsystems Inc.
[14/01/03 09:42:53:973][org.apache.commons.httpclient.HttpClient-] Java class path: XMLSignatureFactory; [14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "3"

[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "3"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\r]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\n]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "{"infocode":"000000","infotext":"","result":"true"}"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\r]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\n]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "0"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\r]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\n]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\r]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\n]"
[14/01/03 09:42:54:286][org.apache.commons.httpclient.Wire-wire] << "[\r][\n]"

怎么设置可以不让他打印这些

2个回答

baishuo678
baishuo678   2015.03.19 10:50

在开始的时候设置系统的属性才可以关闭。具体要加入以下语句。
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.org.apache.commons.httpclient", "stdout");

baishuo678
baishuo678   2015.03.19 10:51

或者:

Csdn user default icon
上传中...
上传图片
插入图片