You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing log files (and to the console), it's sometimes desirable to include various properties not formatted into the message, and not explicitly specified in the output template.
This might look like:
Log.Logger =new LoggerConfiguration().WriteTo.Console(outputTemplate:"{Level:u2} {Message} {Properties}{NewLine}").CreateLogger();
Log.ForContext("Foo",42).Information("Hello from {Bar}!","bar");// -> INF Hello from "bar"! {Foo: 42}
Note that the properties written should exclude those already formatted into the template; it's a text logging scenario, if a full property listing is desired one of the JSON formatters will cover that case.
Marked breaking because this will interfere will logs that already use a static {Properties} element in their output templates, though in practice I can't see this appearing in many places.
The text was updated successfully, but these errors were encountered:
(It's possible to hack this into OutputProperties today without a huge amount of overhead, but rewriting OutputProperties to work more efficiently would be a great general improvement - there are a few unnecessary allocations we could clean up in there.)
Pliner
added a commit
to skbkontur/serilog
that referenced
this issue
Mar 6, 2017
Via: http://stackoverflow.com/questions/38894310/serilog-saving-event-properties-added-with-forcontext-into-flat-files
When writing log files (and to the console), it's sometimes desirable to include various properties not formatted into the message, and not explicitly specified in the output template.
This might look like:
Note that the properties written should exclude those already formatted into the template; it's a text logging scenario, if a full property listing is desired one of the JSON formatters will cover that case.
Marked
breaking
because this will interfere will logs that already use a static{Properties}
element in their output templates, though in practice I can't see this appearing in many places.The text was updated successfully, but these errors were encountered: