I use the configuration below to create a logger:
'log' => [
'logger' => [
'writers' => [
'stream' => [
'name' => 'stream',
'priority' => \Zend\Log\Logger::INFO,
'options' => [
'stream' => __DIR__ . '/../../data/log/name_' . date("Ym") . '.log',
'formatter' => [
'name' => \Zend\Log\Formatter\Simple::class,
'options' => [
'format' => '%timestamp% %priorityName% : %message% %extra%',
'dateTimeFormat' => 'c',
],
],
],
],
],
'processors' => [
'requestid' => [
'name' => \Zend\Log\Processor\RequestId::class,
],
'backtrace' => [
'name' => \Zend\Log\Processor\Backtrace::class,
],
],
],
],
Log works fine but php error not logged nowhere.
Why?
I use this code to generate a simple error
$d1 = new DateTime();
$d2 = new DateTime();
$a = array($d1,$d2);
$a->format("Y-m-d");
in my controller class.
This error is not logged
In PHP 7 ther's Error class to catch Fatal error
Error class