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

Output errors to Serilog.SelfLog for exceptions #238

Open
1 of 2 tasks
almostchristian opened this issue Feb 6, 2024 · 1 comment
Open
1 of 2 tasks

Output errors to Serilog.SelfLog for exceptions #238

almostchristian opened this issue Feb 6, 2024 · 1 comment
Labels
feature-request A feature should be added or improved. module/logging p2 This is a standard priority issue queued

Comments

@almostchristian
Copy link

Describe the feature

Serilog has a facility that allows components to report errors during operation. The AWS Serilog Sink should report errors to this SelfLog. https://github.com/serilog/serilog/wiki/Debugging-and-Diagnostics

Use Case

Our application uses multiple sinks, for example a sqlserver sink, and errors from those sinks are logged in the Selflog. Our applications plugs in to the self log and will report itself as unhealthy if there are messages in the self log. We also record this logs for later inspection, and display it in a verbose healthcheck for the dev environment.

The AWSSerilog sink however only writes errors to a text file aws-logger-errors.txt for logging errors. However this file may never be created depending on the rights of the user account, for example in hardened

Proposed Solution

AWSLoggerCore should expose a new optional constructor argument or a new constructor overload with an argument Action<string> onError. If this is set, the LogLibraryServiceError method should invoke this delegate instead of creating the log file. AWSSink will then use this method write to the SelfLog.

_core = new AWSLoggerCore(loggerConfiguration, "SeriLogger", m => Serilog.Debugging.SelfLog.WriteLine(m));

Creating an optional constructor argument will be a binary breaking change, but creating a new overload will not produce a breaking change.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS .NET SDK and/or Package version used

AWS.Logger.SeriLog 3.3.0

Targeted .NET Platform

.NET 6, .NET 8

Operating System and version

Linux .NET docker containers

@almostchristian almostchristian added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 6, 2024
@bhoradc
Copy link

bhoradc commented Feb 9, 2024

Hi @almostchristian,

Thank you for submitting the feature request. I will have to review this with the team.

Regards,
Chaitanya

@bhoradc bhoradc added module/logging needs-review p2 This is a standard priority issue queued and removed needs-triage This issue or PR still needs to be triaged. needs-review labels Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. module/logging p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

2 participants