Hello.
I’m trying to save logs in job like this:
Logger options:
'class' => 'app\components\LogDbTargetCustom',
'levels' => ['error', 'warning', 'info', 'profile'],
'categories' => ['api', 'cron', 'yii\queue\Queue', 'queue', 'collection', 'firewall'],
'except' => [ 'application', 'yii\web\HttpException:*' ],
Queue options:
'class' => \yii\queue\db\Queue::class,
'db' => 'db', // Компонент подключения к БД или его конфиг
'tableName' => '{{%queue}}', // Имя таблицы
'channel' => 'default', // Выбранный для очереди канал
'mutex' => \yii\mutex\MysqlMutex::class, // Мьютекс для синхронизации запросов
'as log' => \yii\queue\LogBehavior::class,
Job (a part for debugging):
<?php
namespace app\jobs;
use Yii;
use yii\base\BaseObject;
class AddDistributedSyncRecordsJob extends BaseObject implements \yii\queue\JobInterface
{
public function execute($queue)
{
\Yii::error('error', yii\queue\Queue::classname() );
\Yii::warning('warning', yii\queue\Queue::classname() );
\Yii::info('info', yii\queue\Queue::classname() );
\Yii::getLogger()->flush(true);
}
Queue worker run as “yii queue/listen 5 -v” and job is working properly (there are messages like “Job started / job done” in console).
But in my log table I receive only ‘error’ and ‘warning’ records, ‘info’ is absolutely ignored.
Why can’t I save ‘info’ messages?
Thank you.