| title | ISendResponseProvider::GetLogData Method |
|---|---|
| description | The ISendResponseProviderGetLogData method retrieves the logging information for the current response. |
| ms.date | 10/07/2016 |
| ms.assetid | 2c5f2ce8-2f94-7147-2b00-5b81f5091489 |
Retrieves the logging information for the current response.
virtual VOID* GetLogData(
VOID
) const = 0; This method takes no parameters.
A pointer to VOID.
The GetLogData method retrieves a VOID pointer, which you cast to an HTTP_LOG_FIELDS_DATA structure to process log information.
Note
The HTTP_LOG_FIELDS_DATA structure is defined in the Http.h header file.
Important
Your HTTP module must set the registration priority to PRIORITY_ALIAS_FIRST or PRIORITY_ALIAS_HIGH, or GetLogData will always return NULL. For more information about setting the registration priority, see the IHttpModuleRegistrationInfo::SetPriorityForRequestNotification method.
Before you call GetLogData, you need to call the ISendResponseProvider::GetReadyToLogData method to verify that IIS is ready to log information. When GetReadyToLogData returns true, your module can use the GetLogData method to retrieve the log information.
The following code example demonstrates how to create an HTTP module that uses the GetReadyToLogData method to determine whether IIS is ready to log information. The module completes the following steps:
-
Uses the
GetLogDatamethod to retrieve anHTTP_LOG_FIELDS_DATAstructure. -
Uses this structure to retrieve the server name from the log information.
-
Modifies the server port in the log entry.
-
Uses the SetLogData method to submit the modified log information to IIS.
-
Returns the server name to a Web client and then exits.
[!code-cppISendResponseProviderGetLogData#1]
Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the /EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.
You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.
| Type | Description |
|---|---|
| Client | - IIS 7.0 on [!INCLUDEwinvista] - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
| Server | - IIS 7.0 on [!INCLUDEwinsrv2008] - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
| Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 - [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100] |
| Header | Httpserv.h |
ISendResponseProvider Interface
ISendResponseProvider::GetReadyToLogData Method
ISendResponseProvider::SetLogData Method