Provide options for rotating log files in a specified directory and to output console debug to log file

This patch adds the following options:
* logdir: The directory in which rotating log files shall be placed
* retaindays: The number of days log files should be retained before being automatically removed
* redirect_console:  Which console debugging functions (log, debug, warn, error) should be redirected to the logging stream

This patch is backward compatible, by simply omitting the new options.