SMXCore / SMXCore_NG

Open Source for Smart Meter eXtension developed in H2020 Nobel Grid project and improved in various other projects
GNU General Public License v3.0
8 stars 5 forks source link

Implement logging in all Modules #14

Open StelarCF opened 7 years ago

StelarCF commented 7 years ago

Currently, each module handles logging differently. Each one must be converted to use the java.util.logging.Logger class now provided by the base Module class as logger.

With a system to configure what logging level can be used by the logger in a fine-grained fashion (per loaded module), we will use, for now, the following scheme:

Severe - should be used for very rare, high-importance messages such as errors and certain exceptions, but also messages such as modules that have successfully started to aid in diagnosing issues after the fact. Warning - should be used for fairly rare, high importance messages that are not breaking in themselves, but may lead to a corrupt state or missing optional functionality in a module. Info - Should be used for medium importance messages that can be used to diagnose other issues, but are not necessary by themselves to start understanding a problem, as this is the first level that is not printed by default Config - Should be primarily used for messages regarding configuration and configuration state changes (for example, if a variable in the real-time database instructs a module to disable or reenable some functionality) Fine, Finer, Finest - Should be used for high-frequency messages that do not have any role in initial module diagnosis, but may be used for debugging once the module the issue has occured in has been tracked down.

As a rule of thumb, Fine would be used for messages that occur roughly every 10 seconds to a minute (i.e. once every other loop or every loop of a module), Finer for messages that occur roughly every second to 10 seconds (i.e. every loop or several times every loop of a module), while Finest would be used for anything that occurs more often (even many times) than a second. This remains, however, subject to change.

beaylott commented 7 years ago

We likely need to also add code to catch more specific exceptions. In many cases only the base exception class is used.