Adds logging to the files

Need to relate errors to a .log file now.