$dispatcher = Yii::$app->log;
Yii::info('Testing');
the First one gives all the things needed, but the second one when going inside yii\log\Logger
,
it doesn’t have \yii\log\Dispatcher
assigned to the dispatcher attribute of \yii\log\Logger
class
So, it’s not being flushed.