Check that logfile exists before trying to register callbacks to avoid crash.