Configuring and Enabling Server Side Logging

The application enables logging on the server session or the URL group before sending the response with HttpSendHttpResponse. The following example shows how to configure and enable W3C type server side logging:

  1. The application initializes the HTTP_LOGGING_INFO structure with HttpLoggingTypeW3C specified in the Format member, and a bitmask of the HTTP_LOG_FIELD constants in the Fields member.
  2. The application calls HttpSetServerSessionProperty or HttpSetUrlGroupProperty with HttpServerLoggingProperty specified in the Property parameter and a pointer to the HTTP_LOGGING_INFO structure in the pPropertyInformation parameter.

The bitmask of the HTTP_LOG_FIELD constants contain the fields that may be logged in the W3C log file. Note that setting the HttpServerLoggingProperty property on a server session or a URL group does not mean that HTTP responses will be logged. Logging is performed on a per request basis when W3C is enabled in the call to HttpSendHttpResponse or HttpSendResponseEntityBody.

To enable W3C response logging on a per request basis, the application performs the following steps:

  1. The application initializes the members of the HTTP_LOG_FIELDS_DATA with the field information that will be logged for that response.
  2. The Base.Type member of the HTTP_LOG_FIELDS_DATA structure should be initialized to HttpLogDataTypeFields. The Base.Type field ensures the future extensibility of the structure and API.
  3. The application calls HttpSendHttpResponse or HttpSendResponseEntityBody with a pointer to the HTTP_LOG_FIELDS_DATA structure in the pLogData parameter. The application should type cast the pointer to PHTTP_LOG_DATA.