Create the log directory only if needed