Opening a Log File for Writing and Writing to the Log File
Open a log file for writing by calling PdhOpenLog and specifying a log file name as the szDataSource parameter. PdhOpenLog is used only to open a log file for a write operation.
Do the following to write to a log file:
- Call PdhOpenQuery to establish the source of the performance data that will be written to the log file. This can be either a real-time source or a log file.
- Call PdhOpenLog, passing in the handle to the query object created by the earlier call to PdhOpenQuery.
- Update the query and collect the performance data from the data source by calling PdhUpdateLog.