如何在测试环境中禁用任何日志?与config_dev.yml
文件中正确的monolog设置相关的问题,该文件继承自monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped_main
streamed_main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
grouped_main:
type: group
members: [streamed_main]
console:
type: console
bubble: false
verbosity_levels:
VERBOSITY_VERBOSE: INFO
VERBOSITY_VERY_VERBOSE: DEBUG
channels: ["!doctrine"]
console_very_verbose:
type: console
bubble: false
verbosity_levels:
VERBOSITY_VERBOSE: NOTICE
VERBOSITY_VERY_VERBOSE: NOTICE
VERBOSITY_DEBUG: DEBUG
channels: ["doctrine"]
,其中config如下所示:
{{1}}
答案 0 :(得分:-1)
您可以使用继承来更改处理程序的类型,甚至是级别:
config_test.yml
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped_main
streamed_main:
type: fingers_crossed
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: error
您也可以更改为bubble: false
也许您也可以重新考虑不使用日志,您可以将其保存在系统日志和其他后端,这对您来说更方便!