Closed zachrybaker closed 2 months ago
Note, I also tried explicitly pushing the property....to no avail. Hoping someone just sees an obvious configuration issue on my end!.
using (LogContext.PushProperty("event_type", event_type))
{
Log.Information("{shadow_requestSeparator}{\n\t\"Request\": {\n\t\t\"ProgramInfo\": {@shadowLogInfo},\n\t\t\"CallData\":{@parameters},\n\t\t\"EventType\":\"{event_type}\"\n\t}",
shadow_requestSeparator, shadowLogInfo, parameters, event_type);
}
Hi!
With 4.0 Upgrade, filtering by code stopped working (smoking gun?)
This will be an easier place to start investigating than the config example, which is a lot bulkier to dig through.
A minimal code-based repro (just Serilog and one sink) would help narrow this down. Getting everything into a single, minimal, Program.cs with nothing extra (no enrichers, no app-specific setup) is ideal. Thanks!
Upgrading to 4.0, this property name became invalid: "event_type" I had used it for years, without complaint.
Changed it to EventType, all is well again.
Thanks for the follow-up! event_type
still works as a property name for me:
Log.Information("Test {event_type}", 2);
prints:
[09:19:58 INF] Test 2
Description With 4.0 Upgrade, filtering by code stopped working (smoking gun?) So I took a stab at filtering by configuration, using this project along with appsettings.json package. I have not been able to get the configuration to respect my filter json configuration, after careful reading of the readme.
Reproduction
log configuration json:
this will return the log in the wrong file, also formatted very wrongly (note the miss on the 2nd parameter):
Expected behavior It would look like this if working correctly.
Relevant package, tooling and runtime versions What Serilog version are you using, on what platform? 4.0.1 on Windows.
Additional context That Log entry worked fine with this below mix of appsettings-based and code-based configuration prior to 4.0:
I have tried event-type, event_type etc in the property name DSL, to no avail.