Only write to log file if one is present