serilog-web / classic

[Discontinued] Serilog web request logging and enrichment for classic ASP.NET applications
Apache License 2.0
79 stars 32 forks source link

EnableFormDataLogging not logging anything with WebApi #64

Closed Dypso closed 3 years ago

Dypso commented 5 years ago

I have used this sink along with classic-webapi and use this syntax at configuration


 .EnableFormDataLogging(forms => forms
                    .AtLevel(LogEventLevel.Information)
                    .FilterKeywords(new[] { "password", "authToken" })
                )

But when I post data to my webApi I see no any information logged ... Is that even possible ? Or does it only make sense on a ASP.Net MVC project ?

tsimbalar commented 5 years ago

FormDataLogging logs data posted through actual "Web Forms", i.e. via an actual "http form" , with application/x-www-form-urlencoded or similar.

In Web API, you typically POST contents as application/json , so you don't actually have explicit fields/values.

So to sum up : that can work only with WebForms or MVC :)

tsimbalar commented 5 years ago

maybe related to https://github.com/serilog-web/classic/issues/35 ?