Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to suppress xray logging in AWS #341

Open
chaitanguttarlapalli opened this issue Jul 18, 2022 · 7 comments
Open

Unable to suppress xray logging in AWS #341

chaitanguttarlapalli opened this issue Jul 18, 2022 · 7 comments
Assignees
Labels

Comments

@chaitanguttarlapalli
Copy link

In log4j2.xml when we try to disable xray logging it does not work ,

The below unwanted logs keep appearing in aws logs

Jul 18, 2022 1:14:44 PM com.amazonaws.xray.config.DaemonConfiguration
Jul 18, 2022 1:14:44 PM com.amazonaws.xray.AWSXRayRecorder

@srprash
Copy link
Contributor

srprash commented Jul 18, 2022

Hi @chaitanguttarlapalli
Can you provide more information on how are you disabling the X-Ray logging in your application?

The below unwanted logs keep appearing in aws logs
Jul 18, 2022 1:14:44 PM com.amazonaws.xray.config.DaemonConfiguration
Jul 18, 2022 1:14:44 PM com.amazonaws.xray.AWSXRayRecorder

Do you see any specific log messages from these classes or just the above mentioned log statements?

@chaitanguttarlapalli
Copy link
Author

Hi @srprash , please find the config here











<Loggers>
    <Root level="${env:LOG_LEVEL:-info}">
        <AppenderRef ref="Lambda" />
    </Root>

   <Logger  name="com.amazonaws" level="info">
        <AppenderRef ref="Lambda" />
    </Logger>
    <Logger name="com.amazonaws.xray" level="FATAL">
        <AppenderRef ref="Lambda" />
    </Logger>
    <Logger name="software.amazon.awssdk" level="warn" >
        <AppenderRef ref="Lambda" />
    </Logger>
    <Logger name="com.networknt.schema" level="info">
        <AppenderRef ref="Lambda" />
    </Logger>
</Loggers>

@NathanielRN
Copy link
Contributor

Hi @chaitanguttarlapalli, could you please provide the full log message? Or even better yet, can you point out which line of code in this X-Ray SDK is emitting that log message you posted above?

Jul 18, 2022 1:14:44 PM com.amazonaws.xray.config.DaemonConfiguration
Jul 18, 2022 1:14:44 PM com.amazonaws.xray.AWSXRayRecorder

I ask because I don't think our X-Ray Java SDK emits just "class name" like your logs above seem to suggest. If you post the full output we can probably look at why that line of code isn't suppressing logs correctly?

I'm less familiar with Java but your configuration might benefit from level="error" to be consistent with your other loggers?

@chaitanguttarlapalli
Copy link
Author

Hi @NathanielRN , the log message is triggered when the classes are loaded , it does not come from our code . I have attached the complete log of one of the lambda functions here , please have a look.

log-events-viewer-result.csv

@srprash srprash self-assigned this Aug 1, 2022
@srprash
Copy link
Contributor

srprash commented Aug 8, 2022

Hi @chaitanguttarlapalli
I'm not sure if this is due to setting log level to all caps FATAL, as I suspect log4j may only recognize lower case levels. Could you try setting log level to fatal and see if that works? Also, if that doesn't work, try setting the log level as application property as mentioned in this public doc: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-configuration.html#xray-sdk-java-configuration-logging

@chaitanguttarlapalli
Copy link
Author

I tried the caps and lower both , I suspect the logs happen during class loading even before the log4j.xml is loaded .

@willarmiros
Copy link
Contributor

Hi @chaitanguttarlapalli, are there log statements after those initial statements still appearing (e.g. for every request), or is it only the startup logs that appear?

One other strategy is that this SDK uses Apache commons logging, so you can remove the log4j-jcl JAR from your classpath to remove the bridge that sends the logs from the SDK to your Log4J if you're not using it for anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants