在 Symfony5 中记录弃用
Log deprecations in Symfony5
我意识到,我的反对意见不再显示了。现在我尝试通过 monolog 记录它们,希望如此,当我 运行 我的测试时,弃用记录在一个特殊的日志中。我使用 symfony 5.3
这是我的测试独白配置:
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"
现在我将弃用日志记录到一个额外的弃用日志文件中(很好!),但它们还向我的普通日志文件发送垃圾邮件!
仅在弃用日志中获取弃用的正确配置是什么?
看来您应该将“!deprecations”替换为“!deprecation”。
我意识到,我的反对意见不再显示了。现在我尝试通过 monolog 记录它们,希望如此,当我 运行 我的测试时,弃用记录在一个特殊的日志中。我使用 symfony 5.3
这是我的测试独白配置:
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"
现在我将弃用日志记录到一个额外的弃用日志文件中(很好!),但它们还向我的普通日志文件发送垃圾邮件!
仅在弃用日志中获取弃用的正确配置是什么?
看来您应该将“!deprecations”替换为“!deprecation”。