Dynamic log configuration file


#1

In theory with log4rs logging system you just have to define the refresh_rate parameter in the log configuration file to allow automatic reconfiguration of the loggers when this file is modified. The problem is that this doesn’t work in maidsafe_utilities, though it is based on log4rs. Worse: if this parameter is added in the log.toml file, then logging doesn’t work at all.

I forked the crate to try to make this work. First, I upgraded log and log4rs to their latest versions (0.4 and 0.8, respectively). This didn’t improve the situation. Then, I used the yaml format instead of the toml format and this solved the problem: when the program is run a modification in the log file is dynamically taken into account.

This feature is useful when we want to dynamically change the content or the destination of the logs. I used it in my fork of safe_vault which displays some statistics about a running vault (and allowed me to find what I think is an issue in WHM).

IMO, Maidsafe should integrate this standard log4rs feature. No necessarily the way I did it, the team could also make the refresh_rate parameter work in toml format (and maybe it is just that I didn’t find the right syntax to integrate it in the file).


#2

Hi @tfa - thanks for raising this.
We’re having a look into it and we’ll get back to you.
Have a good weekend,
David.