5

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.
kloarubeek
  • 2,706
  • 20
  • 24

1 Answers1

1

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!

Ray
  • 12,101
  • 27
  • 95
  • 137
  • thanks! I know the logging API. For this small project it's easier to have 1 log and the IIS logs were a perfect place. I'll have a look at the other case and let you know how it works out! – kloarubeek Jul 10 '19 at 09:21