Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK Version 10.1

Developing Drivers for Data Stores Without SQL

Logging to Event Tracing for Windows (ETW)

By default, the SimbaEngine X SDK logging functionality writes events and messages to text files. You can change this default functionality in your driver to log events and messages to Event Tracing for Windows (ETW) instead.

The basic steps are listed below. For an example of how to implement this in the QuickStart driver, see Example: ETW Logging.

Define the Provider GUID in your Driver Code

When creating a manifest file to define your provider, you created a provider GUID. Add this GUID to the driver's main header file. If you have both 32 and 64-bit drivers, you need to include both GUIDs. If your driver code is used on multiple platforms, ensure the GUID is defined just for Windows platforms. For example:

#if defined(_WIN64)

/// The 64-bit driver specific ETW provider GUID.

const GUID PROVIDER_GUID = {0x69bacf08, 0x09d0, 0x400a, {0xab, 0xd8, 0x52, 0x06, 0xd4, 0xbd, 0x79, 0x39}};

#elif defined(WIN32)

/// The 32-bit driver specific ETW provider GUID.

const GUID PROVIDER_GUID = {0x9bbc191d, 0x1d80, 0x40d1, {0xad, 0xab, 0xe1, 0x1b, 0x97, 0x3a, 0x1e, 0x90}};

#endif

Use the ETWLogger Class in your Driver Code

Change your custom driver code to use the ETWLogger class instead of the DSIFileLogger class.

For example, in the Quickstart sample driver you would have the following QSDriver constructor

QSDriver::QSDriver() : DSIDriver(), m_driverLog(new ETWLogger(PROVIDER_GUID))

{

ENTRANCE_LOG(m_driverLog, "Simba::Quickstart", "QSDriver", "QSDriver");

SetDriverPropertyValues();

...

}

Further Considerations

You may want to refine the example Example: ETW Logging with the following additional functionality:

Enable logging for both 32-bit and 64-bit drivers

If you plan to ship a 32-bit and a 64-bit version of your driver, you need to create a manifest file for each version. For example, create a QuickStart32.man and a QuickStart64.man.

Important:

Be sure you create a different GUID for the 32-bit and the 64-bit manifest files. Each manifest file must have its own, unique GUID.

In the source code, define each provider guid for the correct platform.

Example:

#if defined(_WIN64)

/// The 64-bit driver specific ETW provider GUID.

const GUID PROVIDER_GUID = {0x69bccf01, 0x08d0, 0x400a, {0xbb, 0xc8, 0x52, 0x06, 0xb4, 0xbd, 0x72, 0x39}};

#elif defined(WIN32)

/// The 32-bit driver specific ETW provider GUID.

const GUID PROVIDER_GUID = {0x9bbc737c, 0x1d70, 0x40d9, {0xad, 0xab, 0xe1, 0x8b, 0x17, 0x3a, 0x4e, 0x20}};

#endif

Allowing the user to switch between ETW and File logging

If you want allow your customers to switch between ETW logging and file logging, you can create a registry key that defines the type of logging. Then in your code, instantiate the correct logging class depending on the registry setting.

 

Related Links

Example: ETW Logging