ypereirareis.github.io
ypereirareis.github.io copied to clipboard
Monolog console handler and console channel
Console handler
- allows to control output VERBOSITY and LOGS LEVELS matching.
- allows to output logs and messages in CLI command STDOUT / STDERR.
- logs messages with "console" channel.
- is not taking deduplication configuration into account
- is logging data even if other handlers already dealt with it.
- ./bin/console : Always print errors at the end of the command in readable format (
doRenderException()
invendor/symfony/symfony/src/Symfony/Component/Console/Application.php
)
Recomandatation
- Keep console handler but silent "console" channel on itself to avoid logging on console output.
monolog:
handlers:
# ...
console:
type: console
process_psr_3_messages: false
channels: [..., '!console']
This allows :
- to have clear console output in dev env.
- to not flood console output in production env en case of errors.
- to avoid duplicated errors (main handler and console handler)
- to keep the possibility to change VERBOSITY <=> LOG LEVEL matching.