The SimbaEngine SDK includes a flexible logging system for use in development, troubleshooting, and maintenance of any ADO.NET provider developed with it. The SDK has a default implementation of logging which will log to a text file, which drivers will use unless another logging system is implemented. This article will explain how to enable the default logging for ADO.NET.

For information on how to enable logging for an ODBC or JDBC please refer to the following articles:

Enable Logging in ODBC
Enable logging in JDBC

For information on the logging system please refer to the following articles:

Logging system in C++ DSI
Logging system in Java DSI
Logging system in C# DSI

The logging is configurable to write the files to wherever you’d like. There are three keys involved in modifying the behaviour of the default DSILog implementation that we supply:

– LogLevel – Values: 0 or Off, 1 or Fatal, 2 or Error, 3 or Warning, 4 or Info, 5 or Debug, 6 or Trace (Defaults to Off)
– LogPath – Defaults to empty string meaning current working directory. Enter something like c:temp to have log files created there.
– LogNamespace – Filters the log to a single namespace. Defaults to empty.

The function of LogNamespace may not be clear, so here’s a bit of a clarification. Let’s assume that we choose “Simba.Networking” as the namespace. In your code, you’ll have logging calls such as:

GetLog()->LogFunctionEntrance(“Simba.Driver”, “Connection”, “Begin”);
GetLog()->LogFunctionEntrance(“Simba.Networking”, “Socket”, “Accept”);
GetLog()->LogFunctionEntrance(“Simba.Networking::Utilities”, “SocketUtility”, “DoSomething”);

With the LogNamespace set to “Simba::Networking”, the call logging “Connection.Begin” will not be logged to the file, only the “Socket.Accept” and the “SocketUtility.DoSomething” calls will be logged.

These values are read from the registry: SOFTWARE<Branding>Driver or SOFTWARE<Branding>Server. The Driver section is read when using a stand-alone ODBC driver, the Server section is read when running a server. For the Quickstart sample, this would be SOFTWARESimbaQuickstartDriver. Note that for a 32 bit driver running on 64 bit Windows the registry paths are instead SOFTWAREWow6432Node<Branding>Driver or SOFTWAREWow6432Node<Branding>Server.

Note also that because .NET providers can be compiled as architecture independent, it is possible for the provider to read from either registry hive depending on how it is loaded, as either a 32 or 64 bit provider. The SDK will attempt to read both sections if possible to ensure that if you have logging set it will be enabled.

After enabling logging, you will need to restart your application before a log file will start to be generated.