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

Fix exception logging #2578

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Fix exception logging #2578

merged 1 commit into from
Apr 10, 2024

Conversation

dkbennett
Copy link
Member

@dkbennett dkbennett commented Apr 10, 2024

Summary of the pull request

This fixes the ordering of exception logging such that exceptions will be properly logged.

References and relevant issues

Closes #2577

Detailed description of the pull request / Additional comments

Serilog has multiple valid logging signatures, but the only one that logs exceptions is if the exception is the first argument. Exceptions can be placed validly as 2nd, 3rd, etc. arguments after a string but those are assumed to be part of the message template and otherwise ignored. This resulted in valid log messages but exceptions that were intended to be logged were not being logged.

  • Fixed all Error, Warning, Debug, and Information logging that included an exception at the end of the message and move dit to the front of the message so it would be logged instead of swallowed.
  • Added a few exceptions to Errors that could have had them but didn't.
  • Fixed a few improperly formatted log messages that survived the initial log conversion that were valid but not logging what the author wanted it to log.

Validation steps performed

  • Build validation with all changes.

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

@AmelBawa-msft AmelBawa-msft added the Needs-Second Pull request that needs another approval label Apr 10, 2024
@krschau krschau removed the Needs-Second Pull request that needs another approval label Apr 10, 2024
@dkbennett dkbennett merged commit 79ed0a9 into main Apr 10, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exceptions are not being logged
3 participants