我正在使用Kayako Rest API进行票务服务。我通过apache.commons.httpclient.methods.postmethod调用API。在每次调用Kayako Rest API时,都会在控制台中编写大量日志,如:
14:40:33.716 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.useragent = Jakarta Commons-HttpClient/3.1
14:40:33.722 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.version = HTTP/1.1
14:40:33.723 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.connection-manager.class = class org.apache.commons.httpclient.SimpleHttpConnectionManager
14:40:33.723 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.cookie-policy = default
14:40:33.723 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.element-charset = US-ASCII
14:40:33.723 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.content-charset = ISO-8859-1
14:40:33.724 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.method.retry-handler = org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@74288b49
14:40:33.724 [http-bio-8080-exec-35] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - Java version: 1.7.0_11
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - Java vendor: Oracle Corporation
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - Java class path: D:\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\bin\bootstrap.jar;D:\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\bin\tomcat-juli.jar
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - Operating system name: Windows 7
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - Operating system architecture: amd64
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - Operating system version: 6.1
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SUN 1.7: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration)
14:40:33.736 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunRsaSign 1.7: Sun RSA signature provider
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunEC 1.7: Sun Elliptic Curve provider (EC, ECDSA, ECDH)
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunJSSE 1.7: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunJCE 1.7: SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunJGSS 1.7: Sun (Kerberos v5, SPNEGO)
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunSASL 1.7: Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5, NTLM; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5, NTLM)
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - XMLDSig 1.0: XMLDSig (DOM XMLSignatureFactory; DOM KeyInfoFactory)
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunPCSC 1.7: Sun PC/SC provider
14:40:33.737 [http-bio-8080-exec-35] DEBUG o.a.commons.httpclient.HttpClient - SunMSCAPI 1.7: Sun's Microsoft Crypto API provider
我在log4j.properties中添加了一些配置:
log4j.logger.httpclient.wire.header=WARN
log4j.logger.httpclient.wire.content=WARN
但是此属性不会禁用控制台中的kayako日志记录。任何人都可以帮我禁用kayako调试日志吗?
答案 0 :(得分:2)
我试图为Spring Framework修复它,所以我找到了这个链接:http://www.codingpedia.org/ama/how-to-log-in-spring-with-slf4j-and-logback/
在我的例子中,我在src / main / resources中创建了一个logback.xml文件。
我的代码:http://pastebin.com/s48YY7Jw
您需要使用Kayako的根软件包更改行<logger name="org.springframework" additivity="false">
。您可以使用所需级别更改<level value="INFO" />
。
希望这有帮助。