Only open a logfile if a filename is set.