我意识到,我的弃用不再显示出来。现在,我尝试通过monolog来记录它们,这样,当我运行我的测试时,就有希望在一个特殊的日志中记录这些弃用。我使用symfony 5.3
这是我的测试monolog配置:
monolog:
handlers:
frontend:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.frontend.log"
level: debug
channels: [ "frontend" ]
max_files: 3
deprecation:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
deprecation_filter:
type: filter
handler: deprecation
level: info
channels: [ "php" ]
main:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
channels: [ "!event", "!frontend", "!deprecation" ]
max_files: 3
console:
type: console
process_psr_3_messages: false
channels: [ "!event", "!doctrine", "!console", "!frontend", !deprecation" ]我在轮换测试日志中收到常规消息,但没有创建弃用日志文件。
我的配置有什么问题?
下一次尝试:
monolog:
handlers:
# frontend:
# type: rotating_file
# path: "%kernel.logs_dir%/%kernel.environment%.log"
# level: debug
# channels: [ frontend ]
# max_files: 3
main:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
channels: [ "!event", "!frontend", "!deprecations" ]
max_files: 3
console:
type: console
process_psr_3_messages: false
channels: [ "!event", "!doctrine", "!console", "!frontend", "!deprecations" ]另外还有一个额外的文件deprecations.yaml:
monolog:
channels: [deprecation]
handlers:
deprecation:
type: rotating_file
channels: [deprecation]
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"现在我已经将弃用记录到了一个额外的弃用日志文件中(很好!),但它们还会给我的正常日志文件带来垃圾邮件!
要在弃用日志中仅获取弃用,正确的配置是什么?
发布于 2021-11-22 02:47:26
看起来您应该将"!deprecations“替换为"!deprecation”。
https://stackoverflow.com/questions/67967712
复制相似问题