Logs are filling up with httpclient.wire.content dumps. How can I turn it off?
Asked Answered
E

3

7

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?"

Elope answered 5/5, 2010 at 3:11 Comment(1)
See also this question: https://mcmap.net/q/143650/-disable-httpclient-loggingHerriot
S
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.

Studnia answered 5/5, 2010 at 4:19 Comment(2)
Thanks! I fixed it with a line in the log4j section in my config.groovy. (Though I'm not sure which line did it: to be safe I tried: 'httpclient.wire.content', 'org.apache.commons.httpclient.wire.content' Now I have to back them out one at a time to see which one is the correct syntax!Elope
@Elope can you please explain a bit more. did you figure out the correct line.Foresee
S
8

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>
Seagraves answered 20/2, 2012 at 11:5 Comment(1)
This works well. However, be sure to update the assembly version references listed in the example pom.xml. For example, this is currently the latest entry for: logback-classic: <!-- mvnrepository.com/artifact/ch.qos.logback/logback-classic <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.7</version> </dependency>Christenson
S
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.

Studnia answered 5/5, 2010 at 4:19 Comment(2)
Thanks! I fixed it with a line in the log4j section in my config.groovy. (Though I'm not sure which line did it: to be safe I tried: 'httpclient.wire.content', 'org.apache.commons.httpclient.wire.content' Now I have to back them out one at a time to see which one is the correct syntax!Elope
@Elope can you please explain a bit more. did you figure out the correct line.Foresee
J
0

Here is a simple answer for Tomcat 8.5.1 - currently solved the issue on Centos. Like many, I wasted quite a bit of time on this. the httpclient has built in logging so you can't fix it with log4j or slf4j- and the answer is provided here. This applies if no other logging systems are included.

[http://tomcat.apache.org/tomcat-8.5-doc/logging.html][1]

Create a logging.properties file and place in /src/main/resources - so that it is deployed to WEB-INF/classes (the example changes the default FINE to WARN

Example logging.properties for the servlet-examples web application to be placed in WEB-INF/classes inside the web application:

handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

org.apache.juli.FileHandler.level = WARNING
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = ${classloader.webappName}.

java.util.logging.ConsoleHandler.level = WARNING
java.util.logging.ConsoleHandler.formatter = java.util.logging.OneLineFormatter
Justness answered 19/3, 2020 at 12:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.