php - yii2 error not in log -
i'm getting yii2
error (#8) internal server error occurred.
but can not found in logs.
neither in .access
.error
files apache vhost nor in apache logs
this happens on remote server , can't reproduce locally. there other way see error aside changing error_reporting
on remote server?
make sure have specified log target in configuration , log component loaded during bootstrapping.
example:
return [ 'bootstrap' => ['log'], 'components' => [ 'log' => [ 'targets' => [ [ 'class' => 'yii\log\filetarget', 'levels' => ['error', 'warning'], ], ], ], ], ];
also, check exportinterval
, flushinterval
setting.
from documentation:
log messages maintained in array logger object. limit memory consumption array, logger flush recorded messages log targets each time array accumulates number of log messages. can customize number configuring flushinterval
property of log
component:
return [ 'bootstrap' => ['log'], 'components' => [ 'log' => [ 'flushinterval' => 100, // default 1000 'targets' => [...], ], ], ];
when logger object flushes log messages log targets, not exported immediately. instead, message exporting occurs when log target accumulates number of filtered messages. can customize number configuring exportinterval
property of individual log targets, following,
[ 'class' => 'yii\log\filetarget', 'exportinterval' => 100, // default 1000 ]
because of flushing , exporting level setting, default when call yii::trace()
or other logging method, not see log message in log targets. problem long-running console applications. to make each log message appear in log targets, should set both flushinterval
, exportinterval
1
, shown below:
return [ 'bootstrap' => ['log'], 'components' => [ 'log' => [ 'flushinterval' => 1, 'targets' => [ [ 'class' => 'yii\log\filetarget', 'exportinterval' => 1, ], ], ], ], ];
note: frequent message flushing , exporting degrade performance of application.
Comments
Post a Comment