Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork54
Library does not log extra exception detail for Console Logger#86
-
When using this setup, the extra exception properties are not output |
BetaWas this translation helpful?Give feedback.
All reactions
Hi@eloisetaylor5693 , thanks for reaching out to us.
Serilog.Sinks.Console sink's default output template does not display enriched properties at all. Not forSerilog.Exceptions and not for any other sink (like standardEnrich.FromLogContext() orEnrich.WithProperty).
You need to specify custom template includingProperties like that:
.WriteTo.Console(outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception} {Properties:j}")Then your output will look like that:
2018-12-17 07:30:13.045 +01:00 [ERR] An error occurredSystem.Exception: An exception message. at SerilogExceptionsLibUsingConsoleLogger.Program.ThrowAnException() in C:\Users\kraj…Replies: 4 comments
-
Strange, could you prove a very small reproduction? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Simple example: With packages: Gives this output: But I would have expected to see more exception detail than exception.ToString() gives. For example I would expect to see the data properties in the logged error, based on the documentation for this library. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi@eloisetaylor5693 , thanks for reaching out to us.
You need to specify custom template including Then your output will look like that: What's more, many other sinks are the same. On the other hand, I think that you got a point, that we could be explicit about it in the docs. I will add some guidance regarding the topic. Hope that helps. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
I have extended the |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
This discussion was converted from issue #86 on December 15, 2020 15:24.