Log not working in yii2
<p>i want to put a log in app.log ,My config file </p>

<pre><code> 'log' =&gt; [
        'traceLevel' =&gt; YII_DEBUG ? 3 : 0,
        'targets' =&gt; [
            'file' =&gt; [
                'class' =&gt; 'yii\log\FileTarget',
                'levels' =&gt; ['error', 'warning'],
                'logFile' =&gt; '@root/console/runtime/logs/app.log',
            ],
        ]
    ]
</code></pre>

<p>in controller action</p>

<pre><code> public function actionRankCalculation()
{
    $allConest = Contest::find()-&gt;where('isActive = 1')-&gt;all();
    Yii::trace('start calculating average revenue');
    $response = [];
    /** @var Contest $contest */
    foreach ($allConest as $contest) {
        $videoQuery = Video::find()-&gt;where('contest_id = ' . $contest-&gt;id);
        $videoQuery-&gt;andWhere('isActive = 1');
        $videoQuery-&gt;orderBy([
            'global_likes' =&gt; SORT_DESC,
            'id' =&gt; SORT_ASC,
        ]);
</code></pre>

<p>}
But  Yii::trace('start calculating average revenue'); not working </p>