[英]Symfony2 disable logs in test environment
如何在測試環境中禁用任何日志? 問題糾正獨白建立相關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"]
您可以使用繼承來更改處理程序的類型,甚至更改級別:
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
也許你也可以重新考慮不使用日志,你可以將它保存在syslog和其他后端,這對你來說更方便!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.