I'm moving stuff from my ASP.Net MVC application (.Net Framework 4.7) to a new .Net Core 2.2 API.
In my old MVC application I added some specific POST properties to the IIS logs via HttpResponseBase.AppendToLog(). I can't find a similar method in .Net Core.
My question: how can I add properties that are in the HttpPost to the IIS logs in a .Net Core Api? This is how the logs look like:
2019-06-26 19:34:07 website-ip-address POST /some-endpoint [data-to-log-ended-here] 443 username ip-address etc.
I don't have a direct answer to your question, but I found two posts that may relate to what you are asking
Generally, in an Asp.net Core app it's more common to use its logging API to work with a powerful 3rd party logging libraries like Serilog to easily log to a number of different sources you can choose from. Though IIS is not one of them, I'd recommend take a look at Application Insights which is very popular for doing logging in Asp.net Core applications. Hope this helps somewhat!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With