This package provides an environment for logging errors, warnings, and other messages into a file and/or a database table. All loggers are designed as singletons, and developers can record messages from anywhere in the program. Furthermore, loggers employ different threads to record messages; thus, it does not affect the running time of the main application. In all loggers developers can control the logging level and other parameters by properly setting up the logger configuration file. For instance, if a logger is set to report warning messages, it also reports all higher priority messages, e.g., errors and fatal errors.
Developers simply have to follow the steps below to include a logger into their application:
Step 1 - Specifying Configuration File (Optional): If the configuration file or sections in the file are different from defaults, they have to be specified in the very beginning of the program.
Step 3 - Reporting Messages: Report messages in the program by calling appropriate functions the logger provides.
Step 4 - Stopping the Logger: Stop the logger explicitly before terminating the program.
The logger starts the moment the first message is reported; thus, developers should not worry about starting it explicitly. For logging into the database, a unique ID is generated for the current logging session, and all messages are recorded with the same ID. When stopping, the logger makes sure that all pending messages are reported before terminating the logging session.