You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem comes when trying to use it in Symfony and YAML.
As stated in the Symfony Docs, adding an handler is as follow (from the docs - https://symfony.com/doc/current/logging.html):
# config/packages/prod/monolog.yamlmonolog:
handlers:
# this "file_log" key could be anythingfile_log:
type: stream# log to var/log/(environment).logpath: "%kernel.logs_dir%/%kernel.environment%.log"# log *all* messages (debug is lowest level)level: debugsyslog_handler:
type: syslog# log error-level messages and higherlevel: error
The problem comes when you try to add a null logger as following:
# config/packages/prod/monolog.yamlmonolog:
handlers:
# this "file_log" key could be anythingfile_log:
type: stream# log to var/log/(environment).logpath: "%kernel.logs_dir%/%kernel.environment%.log"# log *all* messages (debug is lowest level)level: debugsyslog_handler:
type: syslog# log error-level messages and higherlevel: errornull_log:
type: nulllevel: debug
because null is unavailable when using YAML, YAML will parse it as following and retrieve an error to developer:
vagrant@homestead:/srv/www/backend-mallabee$ php /srv/www/backend-mallabee/bin/console mallabee:mp_monitor_sync all
string(6) "stream"
string(6) "stream"
string(7) "console"
string(6) "loggly"
string(5) "raven"
string(0) ""
In MonologExtension.php line 795:
There is no handler class defined for handler "".
This is fixed by adding a quotation to the null handler in it's type as follow:
# config/packages/prod/monolog.yamlmonolog:
handlers:
# this "file_log" key could be anythingfile_log:
type: stream# log to var/log/(environment).logpath: "%kernel.logs_dir%/%kernel.environment%.log"# log *all* messages (debug is lowest level)level: debugsyslog_handler:
type: syslog# log error-level messages and higherlevel: errornull_log:
type: "null"level: debug
The problem is that it's not so obvious that you need to add the quotation until you get bumped into it because the docs doesn't add quotation.
The text was updated successfully, but these errors were encountered:
As defined in here:
https://github.com/symfony/monolog-bundle/blob/master/DependencyInjection/Configuration.php#L25
A developer can user null handler to send logs to no where (obvious usage is testing purposes).
The problem comes when trying to use it in Symfony and YAML.
As stated in the Symfony Docs, adding an handler is as follow (from the docs - https://symfony.com/doc/current/logging.html):
The problem comes when you try to add a null logger as following:
because null is unavailable when using YAML, YAML will parse it as following and retrieve an error to developer:
This is fixed by adding a quotation to the null handler in it's type as follow:
The problem is that it's not so obvious that you need to add the quotation until you get bumped into it because the docs doesn't add quotation.
The text was updated successfully, but these errors were encountered: