删除亚马逊日志

时间:2015-06-17 15:33:49

标签: java logging amazon-web-services amazon-sns

在我的java应用程序中,我使用amazon sns客户端发送消息。 当客户端发送消息时,我的日志中填充了不必要的信息:

66264 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: b2849248-beab-526b-9b8d-dfb32ae41279
66393 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 2eccd920-846e-5c61-bbda-94db1021ee50
66517 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: b9cf62fc-4fa8-597a-acc4-2f07dbe7428e
66642 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: a1e62a32-c456-5ddb-af80-67c95019f5dd
66771 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 196bc624-1a7c-50cd-8cf6-8bdf8e2c54f5
66893 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 34d884f0-b3b2-5be7-9b33-c90b27e20df0
67021 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 6c30d5b6-106b-5db9-b78d-984d843b338a
67148 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 5d8b9e34-67f2-58da-8022-d3cff3a2a8e8
67276 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: dd576d8d-5def-5e30-a6ea-2076c9bf61ca
67400 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: e0eec35f-42ea-55d8-a373-8ea4d6bae22e
67528 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: c139f4e7-f121-59d3-aa74-b91c6571f7e0
67652 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 6c4b1430-1677-5d9c-afce-59cb8227b3af
67774 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: a1b69679-411a-53da-89d9-db82d54b51eb
67916 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: d5ece328-35fc-5fe1-acca-aed3a1ad0df8
68039 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: c4e519bb-5d20-54d7-87f8-5440c97152c0
68158 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 9087ba41-7e1b-53dc-941a-f7baea4ab7e4
68282 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 728e9461-ca8f-541c-8927-d99a5edeec2a
68406 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 84a112d1-fbfa-5f4f-be89-5f2a6fab057a
68529 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 07d95029-340f-58b2-9b02-1dd2a05ea0a4
68656 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: acb67a3c-1307-51a6-bac3-37c787562853
68776 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 846d2134-1583-58d6-8de6-6ccf81d11322
68898 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 87ab9935-cf9e-5f78-8f60-d4ce5bcced61
69018 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: f2b39e06-846f-5f8b-aa2e-d3fd103d2f91
69139 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: df0a30fc-0318-5d32-946a-7d07974a7504
69268 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 63dd09b7-7a73-5749-b3cb-444cee21b75b
69390 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: a61c2cc1-a3f3-59f1-a5dd-613a37a101c7
69519 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 47354f42-d832-5501-83fe-02b94c60c730
69642 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 629986ff-9035-5be5-bcd8-cb040467e3f3
69766 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 4bb8c721-e025-576e-95b9-8ada7476975c
69895 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 4ef4a40a-2515-50ee-a95e-e9f1b1463117
70022 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 4e508411-3293-5786-a238-c9eaa6c09c72
70145 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 2076c936-c777-543d-a6ae-84cd53249624
70271 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 24887bff-d1f5-5473-9c5b-360445a6d642
70395 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: f2c6c056-3de3-5b7c-bfd0-8dada9b0637a
70519 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 8484d633-4430-5af0-ba18-9bc8d063b8e9
70643 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: 5b44deb4-e61b-55a7-b74d-934f7248245e
70771 [pool-1-thread-1] INFO com.amazonaws.http.AmazonHttpClient - x-amzn-RequestId: a0a4411b-84c2-5f4a-9d3c-0ce0109620b0

为了摆脱它,我添加到我的log4j.xml文件中:

<logger name="com.amazonaws">
    <level value="ERROR" />
</logger>

但没有变化。 我想删除aws记录器的INFO级别写入并且只看到ERRORS,我该如何实现?

这是我的log4j.xml:

<appender name="fileAppenderInfo" class="org.apache.log4j.RollingFileAppender">
    <param name="append" value="false" />
    <param name="file" value="logs/appLog.log" />
    <param name="MaxBackupIndex" value="30" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n" />
    </layout>
</appender>

<appender name="fileAppenderErrors" class="org.apache.log4j.RollingFileAppender">
    <param name="append" value="false" />
    <param name="file" value="logs/error/errorLog.log" />
    <param name="MaxBackupIndex" value="30" />
    <param name="threshold" value="ERROR" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n" />
    </layout>
</appender>

<logger name="com.amazonaws">
    <level value="ERROR" />
</logger>


<logger name="org.springframework">
    <level value="ERROR" />
</logger>

<root>
    <level value="INFO" />
    <appender-ref ref="fileAppenderInfo" />
    <appender-ref ref="fileAppenderErrors" />
</root>

1 个答案:

答案 0 :(得分:0)