The SimbaEngine SDK includes a flexible logging system for use in development, troubleshooting, and maintenance of any JDBC 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 JDBC.

For information on how to enable logging for an ODBC driver or ADO.NET provider please refer to the following articles:

Enable Logging in ODBC
Enable logging in ADO.NET

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 “com.simba.networking” as the namespace. In your code, you’ll have logging calls such as:

getLog()->logFunctionEntrance(“com.simba.driver”, “Connection”, “begin”);
getLog()->logFunctionEntrance(“com.simba.networking”, “Socket”, “accept”);
getLog()->logFunctionEntrance(“com.simba.networking.utilities”, “SocketUtility”, “doSomething”);

With the LogNamespace set to “com.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 connection URL, or from the properties bag passed into the connection. Take the following connection URL as an example:

This URL will set the logging level to 6 (Trace) and the logging path to “c:temp”.

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