-
Notifications
You must be signed in to change notification settings - Fork 478
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
WriteUnhandledExceptionToLog in LambdaBootstrap seems to break structured logging setup #1105
Comments
Most likely a feature request rather than a bug. |
Might be related to #1000. |
@LarsAndreasEk this was an issue for me as well. As a workaround Console.SetError from the handler constructor with a custom implementation of a TextWriter which does nothing when WriteLine(object o) is called suppresses the output. I'm leaving this in case it helps anyone else. This worked for me because I don't use Console.Error from application code. The new behavior should provide an opt-out for customers who are already using tools like Serilog. |
Thanks @bruce-lindsay! I put another workaround in place: Catch exceptions in our own code, log, then throw a custom exception that has a ToString implementation that returns null. |
@LarsAndreasEk Good afternoon. Structured logging support was added as part of PR #1803. Please refer to #1747 for details. Kindly check if it resolves your issue. Thanks, |
Glad to hear! I'm currently not working with that particular stack, so I will just take your word for it :) |
Comments on closed issues are hard for our team to see. |
Description
In 80c440c, the logging behaviour for unhandled exceptions was changed. Exceptions are ToString()-ed and written to Console.Error.
This seems to "break" existing setups where structured logging is in place (ie Serilog). Logs are written twice, once by the application's own structured logging setup, then again to Console.Error using a non-structured approach.
We seem to be left with these options:
If you have any other suggestions, please let me know!
Reproduction Steps
Resolution
It would be nice if it was possible to disable the logging that the LambdaBootstrap does when an unhandled exception is thrown. Or perhaps have a way to provide a delegate that does the logging itself, so that we could have the LambdaBootstrap itself use structure logging.
Might not be a 🐛 bug-report, but causes problems for us at least :)
The text was updated successfully, but these errors were encountered: