Correctly create directory structure for non-existing logfile paths

Instead of only creating the last level of the structure.