arcus-azure / arcus.templates

Collection of .NET templates & tooling to get started very easily.
https://templates.arcus-azure.net
MIT License
18 stars 12 forks source link

Include UseSerilogRequestLogging #468

Open fgheysels opened 2 years ago

fgheysels commented 2 years ago

Should we include UseSerilogRequetLogging in the web-api template ?

With regular logging, logs are quite stuffed with traces regarding the request and response that is generated by ASP.NET. When including the UseSerilogRequestLogging middleware, those logs are tidied up a little bit. More background info can be found here: https://andrewlock.net/using-serilog-aspnetcore-in-asp-net-core-3-reducing-log-verbosity/

stijnmoreels commented 2 years ago

Interesting. But the Arcus request tracking is also there, right? That doesn't fix a little bit the problem? Otherwise, yeah, definitely a thing to consider.

stijnmoreels commented 2 years ago

The way the Serilog request middleware component is set up, it seems that they do kind of the same thing as we do with the HTTP request tracking middleware, but since we also make sure that we provide additional options for tracking headers and bodies, the added-value of this middleware component is maybe not much anymore. It could even obscure the logging as we would track the request twice, in that case.