티스토리 뷰

당신은 this.Use 시도 범주를 . 예를 들어 아래와 같이

            'targets' => [
           [
                           'class' => 'yii\log\FileTarget',
                                           'levels' => ['error'],
                                                            'categories' => ['test1'],
                                                                            'logFile' => '@app/Test/test1.log',
                                                                            
                                                                            
                                                                                        ],
                                                                                        

컨트롤러 액션에서 아래 하나를 사용하십시오

 public function actionIndex(){    
   Yii::error('Test index action', $category = 'test1');   }
   
-------------------

콘솔 구성에서 flushInterval둘 모두 exportInterval를 1로 설정하십시오.

return [
    'bootstrap' => ['log'],
        'components' => [
                'log' => [
                            'targets' => [
                                            [
                                                                'class' => 'yii\log\FileTarget',
                                                                                    'exportInterval' => 1,
                                                                                                    ],
                                                                                                                ],
                                                                                                                            'flushInterval' => 1,
                                                                                                                                    ],
                                                                                                                                        ],
                                                                                                                                        ];
                                                                                                                                        

각 로그 메시지가 로그에 즉시 표시되도록합니다.



출처
https://stackoverflow.com/questions/39915880
댓글
공지사항
Total
Today
Yesterday
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30