tmds / Tmds.Systemd

.NET Core library for interacting with systemd
Other
128 stars 17 forks source link

Include all inner exceptions #45

Closed ygoe closed 3 years ago

ygoe commented 4 years ago

The Journald logger only includes the provided Exception object and its first inner exception. If that has more inner exceptions, those are not logged. Especially with database operations and Entity Framework, the actual database error might be on the third or fourth level of exceptions.

Is there a way that all exception details can be included, like the output of Exception.ToString?

A similar situation is with AggregateException which may contain multiple inner exceptions.

Ideally, the logger would just call Exception.ToString() and put it in a new Journal message field, but also let me provide my own exception formatter Func<Exception, string> as an option.

I'll try to write that up and make a PR for that, as I might need it very soon, and use my own package build for now.