Write to the IIS Log with ASP

While trying to come up with new ways to record things that are happening on my Web server, I came across the Response Objects AppendToLog Method. This method allows you to write directly to the IIS Log File using only one line of code. This has come in handy for error trapping and troubleshooting. The following is a piece of sample code that writes a single entry to the log file:
      Response.AppendToLog "Database Being Accessed"

The above line would write the following to your IIS log file:, -, 01/01/00, 12:00:34, W3SVC1,WEBSERVER,, 161342, 485, 228, 200, 0, get, /somefile.asp, Database Being Accessed

Remember that the IIS log file is a comma-delimited file, and you should try to avoid using commas in the data string you pass to the log file.

Note!: the above sample is wrapped for presentation!

asp logfile write to logfile IIS IIS Logfile write to IIS Logfile logs IIS Logs

Back To Top
© 1998 - 2017 psacake.com | My3C's

Version 7.2 | Advertise on this site