0

Issue we are facing is that our log files are getting flooded, when we turn on http logging in log4j.

What we turn on in log4j

<AsyncLogger name="org.mule.module.http.internal.HttpMessageLogger" level="DEBUG"/>

What gets flooded in Log files,

DEBUG 2019-05-30 17:10:27,841 [pool-70-thread-5] com.amazonaws.1.11.453.shade.request: Received successful response: 200, AWS Request ID: 3c336641-******* 
DEBUG 2019-05-30 17:10:27,841 [pool-70-thread-5] com.amazonaws.1.11.453.shade.requestId: x-amzn-RequestId: 3c336641-*********** DEBUG 2019-05-30 17:10:27,853 [pool-70-thread-6] com.amazonaws.1.11.453.shade.request: Sending Request: POST https://sqs.us-east-1.amazonaws.com / ***** 
DEBUG 2019-05-30 17:10:27,853 [pool-70-thread-6] com.amazonaws.1.11.453.shade.auth.AWS4Signer: AWS4 Canonical Request: '"POST

Please suggest, what we need to do to turn off these logs, we want the HTTP logger to be on for our other http request debugging.

ViS
  • 1,357
  • 1
  • 17
  • 36
  • If you `turn on http logging` ,so turn it off. You turned on the `HttpMessageLogger`. So the message which make log into it, will be showed you. Also, you can change Level of logs to Warn, for example – Dred May 30 '19 at 12:20
  • @Dred, we need other Http logs for debugging, what we do not want is the AWS http logging. – ViS May 30 '19 at 12:22
  • Hmm. Also, you can try to make logger to full Package but as appender, use only `HttpMessageLogger` I think... But... let's think about it. Look on the end of that [article](https://support.mulesoft.com/s/article/How-to-Enable-HTTP-Wire-Logging) – Dred May 30 '19 at 12:24
  • 1
    Oh, I found... [here](https://stackoverflow.com/a/5270114/9719337) It is that you want. – Dred May 30 '19 at 12:27

1 Answers1

1

To minimize the logs, you two options.

Option-1 You have to add the below configuration in log4j2 configurations. You can add multiple packages after identifying.

<logger name="com.amazonaws" level="OFF">
        <AppenderRef ref="Console"/>        
        <AppenderRef ref="File"/> 
</logger>

Option-2 You can use the below in the config file.

<AsyncLogger name="org.mule.module.http.internal.HttpMessageLogger" level="ERROR"/>

In this case , only error details will be printed.

Sambit
  • 7,625
  • 7
  • 34
  • 65