The SimbaEngine SDK includes a flexible logging system for use in development, troubleshooting, and maintenance of any ODBC driver 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 ODBC.
For information on how to enable logging for an JDBC driver or ADO.NET provider please refer to the following articles:
For information on the logging system please refer to the following articles:
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 DSIFileLogger 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.
- LogFileCount – The number of files to create before starting to delete older files as newer files are created. This is used in conjunction with LogFileSize for log file rollover.
- LogFileSize – The maximum size in bytes for each log file before a new file is created. Older files may be deleted according to LogFileCount.
- 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.
Enabling Logging on Windows
The keys indicated above are read from the registry at one of the following locations:
The Driver section is read when using a stand-alone ODBC driver, the Server section is read when running a server.<Branding> is controlled by the call to SetConfigurationBranding() in your Main_Windows.cpp file.
For the Quickstart stand-alone sample, this would be HKLM\SOFTWARE\Simba\Quickstart\Driver, as the call to SetConfigurationBranding() is passed a value of “Simba\\Quickstart”.
Note that for a 32 bit driver running on 64 bit Windows the registry paths are instead:
After enabling logging, you will need to restart your application before a log file will start to be generated.
Enabling Logging on Unix/Linux/OSX
The keys indicated above are read from an ini file that is co-located with the driver binary. The name of this ini file is <Branding>, where <Branding> is controlled by a call to SetConfigurationBranding() in your Main_Unix.cpp file.
For the Quickstart stand-alone sample, this would be simba.quickstart.ini, as the call to SetConfigurationBranding() is passed a value of “simba.quickstart.ini”.
Within the .ini file, there will one of two sections:
The Driver section is read when using a stand-alone ODBC driver, the Server section is read when running a server. For the sample Quickstart driver, we have supplied two separate .ini files, simba.quickstart.ini and simbaserver.quickstart.ini which contain the driver and server settings, respectively.
The logging keys will be read from the relevant section of the .ini file based on the deployment. After enabling logging, you will need to restart your application before a log file will start to be generated.