Logging to file

Logging should be more consistent now and logs to a file.