问题
My catalina logs are filling up with gobs of statements like:
/logs/catalina.out:2010-05-05 02:57:19,611 [Thread-19] DEBUG httpclient.wire.content - >> "[0x4]
[0xc][0xd9][0xf4][0xa2]MA[0xed][0xc2][0x93][0x1b][0x15][0xfe],[0xe]h[0xb0][0x1f][0xff][0xd6][0xfb]
[0x8f]O[0xd4][0xc4]0[0xab][0x80][0xe8][0xe4][0xf2][\r]I&[0xaa][0xd2]BQ[0xdb](zq[0xcd]ac[0xa8]
on and on forever.
I searched every config file in both tomcat and apache for the statements that purportedly turn this on as described here:
http://hc.apache.org/httpclient-3.x/logging.html
And I don't see where this logging has been enabled. No other .war I deployed does this. The log4j configuration block in the app isn't doing it.
I also tried to turn it off with statements like this:
org.apache.commons.httpclient.wire=SEVERE
or
org.apache.commons.httpclient.wire.content=SEVERE
or
httpclient.wire.content=SEVERE
in my tomcat/conf/logging.properties file, and that didn't stop it
I'm using an S3 library for grails that may be the source for these. However when I run this application on my development machine (in both develop and deploy configs), I'm not seeing it.
And a related question: When would I want to use these "wire logs?"
回答1:
Do you have any additional logging library in your Tomcat common/lib? (i.e SLF4J, Logback, Log4J, etc)
If yes, you may want to configure the respective logging configuration file as well.
回答2:
For Slf4J:
<dependencies>
<!-- LOGGING -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.5.9-RC0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.9-RC0</version>
</dependency>
</dependencies>
And put logback.xml in your classpath with the content below:
<configuration>
<!-- LOGBACK logging config file, see http://logback.qos.ch/manual/joran.html -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<!-- http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout -->
<Pattern>%-5level %msg [%logger{16} %d{HH:mm:ss}]%n</Pattern>
</layout>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
<logger name="org.apache" level="WARN" />
<logger name="org.apache.axis2" level="WARN" />
<logger name="org.apache.axiom" level="WARN" />
<logger name="httpclient.wire" level="WARN" />
</configuration>
来源:https://stackoverflow.com/questions/2770382/logs-are-filling-up-with-httpclient-wire-content-dumps-how-can-i-turn-it-off