Changed order of error checking

Grouped logPath error checking with creating log files. This does not
change the functionality.