日志被 httpclient.wire.content 转储填满。我怎样才能将其关闭?

发布于 2024-08-31 20:48:35 字数 1057 浏览 4 评论 0原文

我的卡塔琳娜日志充满了诸如“

/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]

永远持续下去”之类的语句。

我搜索了 tomcat 和 apache 中的每个配置文件,以查找据称打开此功能的语句,如下所述:

http://hc.apache.org/httpclient-3.x/logging.html

我没有看到在哪里启用了此日志记录。我部署的其他 .war 没有执行此操作。应用程序中的 log4j 配置块没有执行此操作。

我还尝试用这样的语句将其关闭:

org.apache.commons.httpclient.wire=SEVERE

or

org.apache.commons.httpclient.wire.content=SEVERE

or

httpclient.wire.content=SEVERE

在我的 tomcat/conf/logging.properties 文件中,但这并没有阻止它,

我正在使用 grails 的 S3 库,它可能是这些库的来源。但是,当我在开发计算机上运行此应用程序(在开发和部署配置中)时,我没有看到它。

还有一个相关的问题:我什么时候想使用这些“线路日志”?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

别忘他 2024-09-07 20:48:35

对于 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>

并将 logback.xml 放入类路径中,内容如下:

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

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>
围归者 2024-09-07 20:48:35

您的 Tomcat common/lib 中是否有任何其他日志记录库? (即 SLF4J、Logback、Log4J 等)

如果是,您可能还需要配置相应的日志记录配置文件。

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.

梦途 2024-09-07 20:48:35

这是 Tomcat 8.5.1 的简​​单答案 - 目前已解决 Centos 上的问题。和许多人一样,我在这上面浪费了很多时间。 httpclient 内置了日志记录,因此您无法使用 log4j 或 slf4j 修复它,这里提供了答案。
如果不包括其他日志记录系统,则这适用。

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

创建一个logging.properties文件并将其放置在/src/main/resources中 - 以便将其部署到WEB-INF/classes(该示例将默认的FINE更改为WARN

servlet-examples Web 应用程序的示例logging.properties 放置在Web 应用程序内的WEB-INF/classes 中:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文