logging - 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
执行后在前端/运行时查看日志。
实际结果:日志为空。
解决方案
推荐阅读
- javascript - Moving an image Javascript
- javascript - 如何制作一个循环打印出第一个字母,然后在新行上打印两个,等等 - javascript
- python-3.x - 使用预训练的 gensim Word2vec 嵌入以及 keras 中的数据集
- azure - Azure APIM 定价层和虚拟网络
- c++ - 在这个有效的斐波那契函数中,它不是传递可以存储在数组中的元素数量吗?
- android - Android SQLite - Update table 1 based on changes in table 2
- java - Parsing JSON File using Gson
- ios - 如果输入为空,如何按 ALL 过滤?SwiftUI/核心数据
- powerbi - 如何在 Power BI 嵌入式代码中实现安全性?
- c++ - Qt StyleSheet to programmatically createdQWidget