0

I am learning ASP.NET Core Web API - currently I am learning the topic of filter. I created a custom filter and I want to print some logs on the console screen to check whether my filter is working or not, but I am not getting any kind of log in the output section.

This is the code for my filter where I am printing something with the help of Console.Writeline:

This is the code for my filter where I am printing something with the help of Console.Writeline

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 2
    Web apps run on web servers (even when you are debugging, your machine is playing the role of a web server). Server apps don't have a console. In part, because servers generally don't have a console. The debugger, on the other hand, does have a console. Try `Debug.WriteLine` – Flydog57 Apr 30 '23 at 15:38
  • 1
    i highly recommend you to read this answer https://stackoverflow.com/questions/137660/where-does-console-writeline-go-in-asp-net – Khashayar Pakkhesal Apr 30 '23 at 16:04
  • 1
    You may want to reconsider the entire Console usage. Any logging framework would be of much better use. If CommonLogging nuget is used as a proxy, you're able to change logger implementation pretty much whenever you like. – Alex Seleznyov Apr 30 '23 at 18:12
  • @Flydog57 using Debug.WriteLine solved my problem.Thank you all for your precious time. – Syed Ali Rizvi May 01 '23 at 11:48

0 Answers0