我正在嘗試使用以下 SF6.2-DEV 環境添加一個簡單的記錄器通道“brp”:
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
- brp
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
channels: ["!event","!doctrine","!console"]
幾件事,我需要這個通道將資料庫記錄到我指定的表中,而且我只對“brp”通道中捕獲的資訊、警告和錯誤感興趣。
我已經設法通過簡化的配置訪問該頻道:
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
- brp
但這會記錄到一個檔案中,并包括所有錯誤級別,等等。
TIA
uj5u.com熱心網友回復:
根據此處的官方檔案,您需要執行以下操作:
monolog:
channels: [deprecation,brp]
handlers:
deprecation:
type: stream
channels: [deprecation]
level: error
path: '%kernel.logs_dir%/deprecated.log'
brp:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
channels: ["!event","!doctrine","!console"]
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/490284.html
