首页 > 解决方案 > Yii2:如何在 Codeception 中写日志?

问题描述

我已经从盒子里安装了 Yii2 并且想在代码接收测试中写日志。没有任何错误,但日志为空。我做错了什么?

在 frontend/config/main.php 日志中启用: 'bootstrap' => ['log'],

<?php

namespace frontend\tests\unit\models;

class SomeTest extends \Codeception\Test\Unit
{

    public function testLogMessage()
    {
        \Yii::error('something bad occurred');
    }

}

我的期望:codecept run执行后在前端/运行时查看日志。

实际结果:日志为空。

标签: loggingyii2-advanced-appcodeception

解决方案


推荐阅读