logfile only opens/created when needed