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

pass exception to NLogLogger exception logging #1040

Merged
merged 1 commit into from
Jun 4, 2015

Conversation

ashic
Copy link
Contributor

@ashic ashic commented Jun 3, 2015

Currently, NLogLogger simply logs exception messages as strings. This commit passes the exception to NLog as well. This allows clients to use ${exception:...} layout renderers to choose if they want to log exception details (including stack traces) or not.

Currently, NLogLogger simply logs exception messages as strings.
This commit passes the exception to NLog as well. This allows
clients to use ${exception:...} layout renderers to choose if
they want to log exception details (including stack traces)
or not.
Aaronontheweb added a commit that referenced this pull request Jun 4, 2015
pass exception to NLogLogger exception logging
@Aaronontheweb Aaronontheweb merged commit 4c3c7cf into akkadotnet:dev Jun 4, 2015
@ashic ashic deleted the nlog-exceptions branch June 4, 2015 15:56
@ashic
Copy link
Contributor Author

ashic commented Jun 4, 2015

I'm thinking about this a bit more. It seems that the NLogLogger uses the LogEvent's Message property as the Message passed to NLog. However, LogEvent.ToString() provides a much richer message that includes the logger, correct thread id, etc. This is quite helpful (and in my apps, I'm using a custom logger for this reason specifically), and there are no real alternatives; NLog's layout renderers' ${threadid} won't have the correct thread id, as it'll be the id of the logging actor's thread, and not where the LogEvent originated.

Would it be better if we logged LogEvent.ToString() as the message in NLogLogger?

@Aaronontheweb
Copy link
Member

Would it be better if we logged LogEvent.ToString() as the message in NLogLogger?

@ashic yes,I think so

@ashic ashic restored the nlog-exceptions branch June 5, 2015 00:23
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.

2 participants