mardi 1 mars 2016

Logging and Configuration Systems: Circular Dependency

Assume a typical scenario where the initial settings of an application are loaded at startup from a configuration file. The application also has a logger. The parameters of the logger (e.g. verbosity level, log file path, etc.) are ideally also stored in the configuration file. However, it is also desirable that the configuration loader log information about parameter loading, for example

Attempting to load parameter LogVerbosity. Parameter is absent. Using the default value: 4.

Thus, we see a circular dependency between the two components. The configuration loader needs a ready-to-use logger, and a logger needs configuration parameters to initialize itself. This seems to me to be a problem typical enough to have canonical solutions to it, but I was unable to find anything.

Of course, one can roll some ad-hoc solutions but I'm interested in the best industry practices.

Hope the question makes sense.

Aucun commentaire:

Enregistrer un commentaire