gpt4 book ai didi

php - Symfony2 在测试环境中禁用日志

转载 作者:行者123 更新时间:2023-12-02 05:17:02 25 4
gpt4 key购买 nike

如何在测试环境中禁用任何日志?与 config_test.yml 文件中正确的独白设置相关的问题,该文件继承自 config_dev.yml,其中配置如下所示:

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"]

最佳答案

您可以使用继承来更改处理程序的类型,甚至级别:

配置测试.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

也许你也可以重新考虑不使用日志,你可以将它保存在系统日志和其他后端,这对你来说更方便!

关于php - Symfony2 在测试环境中禁用日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34000321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com