【问题标题】:configure a regex path in yaml to exclude exceptions在 yaml 中配置正则表达式路径以排除异常
【发布时间】:2015-05-03 15:46:57
【问题描述】:

在独白中,您可以排除路径,以便在发生异常时不会登录到 prod.log

我想从 /items/* 中排除所有日志,所以我做了以下操作:

monolog:
    handlers:
        main:
            type: fingers_crossed
            action_level: error
            handler: file
            channels: ["!doctrine", "!event", "!security", "!request"]
            excluded_404s:
                - ^/items/

我想排除 /items/19283712 和任何具有 /items/WHATEVERCRAPINHERE 的错误。 here 显示的文档详细说明了如何执行此操作。我已经尝试了上面的正则表达式,它似乎不起作用。这是为什么呢?

【问题讨论】:

  • 在模式末尾添加 --> .*
  • @MBarnett 所以^/items/.*
  • 试试^/items/*^/items/~

标签: php regex symfony yaml monolog


【解决方案1】:

您可以使用以下语法^/items/*

monolog:
    handlers:
        main:
            type: fingers_crossed
            action_level: error
            handler: file
            channels: ["!doctrine", "!event", "!security", "!request"]
            excluded_404s:
                - ^/items/*

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-04
    • 2018-08-21
    • 2020-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多