added O_CREATE flag when opening log file