php - cakephp 3 using scopes when logging -
i configured logger orders in app.php
'orders' => [ 'classname' => 'cake\log\engine\filelog', 'path' => logs, 'file' => 'orders', 'levels' => ['info'], 'scopes' => ['orders'], ]
and in 1 model of mine did:
log::info("there's order", 'orders');
i expected log message being written in orders.log
shows in debug.log
too.
according documentation:
if there configured logger scope, log messages directed loggers. if log message written unknown scope, loggers handle level of message log message.
what doing wrong?
as wandering around, found this: https://github.com/daoandco/cakephp-logging
to restrict scope 1 logger, add default logger config:
'scopes' => false
like this:
'debug' => [ 'classname' => 'cake\log\engine\filelog', 'path' => logs, 'file' => 'debug', 'levels' => ['notice', 'info', 'debug'], 'scopes' => false, 'url' => env('log_debug_url', null), ], 'error' => [ 'classname' => 'cake\log\engine\filelog', 'path' => logs, 'file' => 'error', 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], 'scopes' => false, 'url' => env('log_error_url', null), ],
that's it! work charm! did test it.
Comments
Post a Comment