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

InnerException logging #135

Open
danielgindi opened this issue May 5, 2020 · 2 comments
Open

InnerException logging #135

danielgindi opened this issue May 5, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@danielgindi
Copy link

In many cases - we need a lot more info, like inner exceptions. Which could go to multiple levels.

In NLog File layout we can specify something like this: <target name="f" type="File" layout="${message}${onexception:EXCEPTION OCCURRED\:${exception:format=type,message,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method}}" /> to log inner exceptions, and with multiple levels.
https://nlog-project.org/2011/04/20/exception-logging-enhancements.html

You could take a look here to see how they handle multiple InnerExceptions, AggregateExceptions etc.

@dustinchilson
Copy link
Owner

This seems like a great add.

The only issue I see is, there's a limit to how much you can stuff in each graylog message.

https://github.com/dustinchilson/NLog.Targets.GraylogHttp/blob/master/src/NLog.Targets.GraylogHttp/GraylogMessageBuilder.cs#L56

I typically handle this situation in the application code and just walk the ex tree and log them separately.

Would you think it's reasonable for a setting to do that automatically?

@dustinchilson dustinchilson added the enhancement New feature or request label May 7, 2020
@dustinchilson dustinchilson self-assigned this May 7, 2020
@danielgindi
Copy link
Author

The only issue I see is, there's a limit to how much you can stuff in each graylog message.

Then it should be trimmed right?

Would you think it's reasonable for a setting to do that automatically?

Yes because it would be duplication of code to do it everywhere you have a logger.Error(ex) call.
Also if you have several NLog configurations, one of them sends to a file, another to graylog - it's weird if one can log inner exceptions and the other dont.

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

No branches or pull requests

2 participants