Optimize  log directory creation