Refactor logging.

Logging to file now automatically watches for changes (e.g. from
external rotation tool) so that it can be re-opened under the original
file name.