问题:在 main 方法中使用 httpclient 时,idea 控制台会疯狂打印 DEBUG org.apache.http.wire 的日志

问题:在 main 方法中使用 httpclient 时,idea 控制台会疯狂打印 DEBUG org.apache.http.wire 的日志,导致 C:\Users\shuang\AppData\Local\ 下生成 idea_test.out 文件,占用非常大的容量。

18:33:28.875 [pool-1-thread-11] DEBUG org.apache.http.wire - http-outgoing-0 << "[0xdd][0x17][0xd9][0x6][0xf8]:[0xb5][0xee][0xc2][0x93]G[0xae]0[0xa8]4f'[0x87][0x91]o%w[0xb6][0xa7][0x17]+F[0x82]N[0x82][0xd4][0x7][0xf1];[0x9a][0xcc][0xdd]C[0x8][0xbd]?[0xb4][0xbe][0x8d][0xdc][0x2][0xb2][0xb3][0xb9][0xff][0xd6]T[0xc6][0x1b][0x10][0x99][0xb1])[0xd3][\r]Q[0xad]y[\n]"
18:33:28.875 [pool-1-thread-4] DEBUG org.apache.http.wire - http-outgoing-3 << "ee[0x97][0xb0][0x16]di[0x10]+[0xce][0x8e][0xfe][0xa1][0x18][0x97][0xc5][0xbe][0x1a][0xb5]7[0x88][0xd5]6[0xd4][0x5][0xeb][0x3][0xbc][0x86]&[0x2][0x17][0x1a][0xf4][0xc0][0xd9]7y[0xff]l[0xe8]'[\n]"
18:33:28.875 [pool-1-thread-4] DEBUG org.apache.http.wire - http-outgoing-3 << "~Nu[0xbe]t[0xe1][\n]"
18:33:28.875 [pool-1-thread-4] DEBUG org.apache.http.wire - http-outgoing-3 << "[0xc3]Q[0xa9][0xd7]?[0xa0]1[0x14][0x19][0xb][0xf0][0x90][0xd2][0xdb]*[0x93][0x86][0x12]1mqurv[0x8a][0xc9]M!Y[0xee][0xd2]jt[0xf9][0xe9][0xa1][0x8a][0xc0][0xe6]L{[0xa6][0xa3][0x17][0xbd][0x1d][0xb]&[0xcf][\n]"

解决:

resources 目录下增加配置文件 logback.xml

<configuration debug="false">
    <logger name="org.apache" level="INFO" />
    <logger name="org.apache.http.wire" level="INFO" />
    <logger name="org.apache.http.headers" level="INFO" />
    <property name="CONSOLE_LOG_PATTERN"
              value="%date{yyyy-MM-dd HH:mm:ss}  %highlight(%-5level) %magenta(%-4relative) --- [%yellow(%15.15thread)] %cyan(%-40.40logger{39}) : %msg%n"/>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
        </encoder>
    </appender>
    <root level="ERROR">
        <appender-ref ref="STDOUT"/>
    </root>
</configuration>

pom.xml 中增加配置

<project>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>    
    </build>
</project>
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值