Share via


Logging customized info in IIS by using AppendToLog

When we try to log HTTP request and response info of IIS, essentially, we'd like to enable IIS logging as W3C extended format. Unfortunately, IIS (at least 6), doesn't allow to log some customized items such as customized HTTP headers. That's what AppendToLog comes from.

Actually, there are two versions of AppendToLog methods. One is IIS COM API (IResponse::AppendToLog); another is ASP.NET (Response.AppendToLog). Both of them will append the string to the request uri in the log entry. Once the response is done, the log entry will be flushed to IIS log file. So developers need to define specific separator to distinguish different logging items if AppendToLog is called multiple times.

One difference between those two is that IResponse::AppendToLog explicitly says there is 80 bytes limitation, but for Response.AppendToLog, my test proves that there is no problem for 1K.