The ability to remotely diagnose problems that occur with software is one of the most important features in widely used software as it:
- Reduces costs: you don’t have to send an engineer to the remote site
- Keeps customers happy: problems are diagnosed and resolved quickly
The SimbaEngine SDK includes a flexible and easy-to-use logging system that greatly facilitates the ability to remotely diagnose problems, which all of the components of the SimbaEngine SDK – ODBC, JDBC ADO.NET, SQLEngine, and client/server – use extensively. I’m going to give a brief run-down of how the logging system is set up and how it’s structured.
Within the SDK, all logging occurs through an object called an ILogger. This interface exposes functions which allow for logging of messages at different levels, from least to most verbose, so that the level of detail that is actually logged can be configured at run-time without modifying code. Additionally, the SDK allows for multiple ILogger objects to be used at the same time so that different objects can log messages to different areas if needed.
As noted, the ILogger is an interface that doesn’t implement any functionality by itself. The SDK supplies a default implementation of the ILogger, called DSILog (or DSILogger in Java and .NET), which implements logging to a file. This implementation allows developers to easily get logging running by changing a few configuration settings, without having to custom code their own logging system. However, if you already have a logging system in place that you would like to integrate with, you can simply extend the DSILog (or DSILogger in Java and .NET) implementation or implement the ILogger interface directly and pass the messages to your existing system.
Our default implementation of DSILog (or DSILogger in Java and .NET) will:
- Log the timestamp of the message
- Level of the message
- Thread ID
- Class name
- Function name
- Message to the log file
If you want to use our implementation of the ILogger, but don’t like the format, simply extend DSILog (or DSILogger in Java and .NET) and change the format to something more suited to your needs. If you are implementing a JDBC driver or ADO.NET provider, we have also added extra utility classes that can automatically detect additional logging parameters so logging can be easily added without having to add lots of extra code to your driver.
Add this all up and you have an easy to use logging system that you can use to help in developing and debugging right out of the box, or one that can be extended or even replaced to integrate with your existing systems.
View complete suite of Logging articles: