Correct error message and improve log behaviour.

Corrects the log behaviour such that it will allow the logged to be
configured with a debug_file that does not exist if it is possible
to create the log file instead (because it is possible to write to the
directory).

Also improves the error messages.