Fix logger for case Yii::$app lost on process exiting

Logger::flush() might be called by register_shutdown_function() when application instance has gone.