Skip to content

Serilog .NET exception logs not detected as exceptions #95

@r-bennett

Description

@r-bennett

I'm using Serilog 2.9.0 in a .NET application, but the output of the standard exception logging method isn't being picked up as an exception so the stack traces are being forwarded one line at a time.

e.g.

logger.LogError(e, "we caught an exception");   

produces

[09:19:23.676 ERR ApprovalBot.Controllers.EventController b497765b27218d428f9a6fd04a4951bf]  we caught an exception
System.Exception: something went wrong
   at ApprovalBot.Controllers.EventController.Baz() in E:\workspace\ApprovalBot\src\Controllers\EventController.cs:line 70
   at ApprovalBot.Controllers.EventController.Bar() in E:\workspace\ApprovalBot\src\Controllers\EventController.cs:line 65
   at ApprovalBot.Controllers.EventController.Foo() in E:\workspace\ApprovalBot\src\Controllers\EventController.cs:line 60
   at ApprovalBot.Controllers.EventController..ctor(ILogger`1 logger, IReadOnlyDictionary`2 eventHandlers, WebHookSecret secret, GitHubUri gitHubUri, IMetrics metrics) in E:\workspace\ApprovalBot\src\Controllers\EventController.cs:line 48

which isn't detected.

Having looked at the source it's not clear why they're not being detected as exceptions.

If there's nothing obviously wrong in the format above could you give me a bit of guidance on the best way to debug this locally please?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions