Search code examples
asp.netiisloggingiis-7remote-debugging

write to IIS log from an ASP.NET application


I want to have my ASP.NET application write lines to a log somewhere. Does IIS provide any built-in way to log ASP.NET log messages? I was thinking there might be a way to capture calls to System.Diagnostics.Debug.WriteLine(), but I can't find any way to do it.


Solution

  • To capture the Debug.Write and Debug.WriteLine use the DebugView from sysinternals.

    http://technet.microsoft.com/en-us/sysinternals/bb896647

    Of course you have to compile with Debug=true or else the functions is not called at all. So the Debug.Write is a good way only for test in real time and debug your application and not a solution to keep log on the errors in general. For the case that you like to save the errors I think that you need to ether use one library of the other user suggestions, or write direct on event viewer your errors.

    ps: For some reason the version 4.78 is not working on my windows xp and I switch back to 4.77