1
我想將所有消息記錄到日誌文件,但只有在排除404 我用這個代碼的正常工作錯誤的情況下發送電子郵件的錯誤,但它並沒有任何意義,我,因爲這個代碼意味着只有達到錯誤級別時纔會觸發主處理程序,那麼它將被記錄或通過電子郵件發送。實際上所有消息仍然記錄到文件中。我在這裏錯過了什麼?日誌中的所有郵件和電子郵件只能用獨白的Symfony
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
excluded_404s:
- ^/
handler: grouped
grouped:
type: group
members: [streamed, deduplicated]
streamed:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
deduplicated:
type: deduplication
handler: swift
swift:
type: swift_mailer
from_email: %noreply_email%
to_email: %webmaster_email%
subject: 'Error Notification %%message%%'
level: error
formatter: monolog.formatter.html
content_type: text/html
login:
type: stream
path: "%kernel.logs_dir%/auth.log"
level: info
channels: security
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
編輯:這裏是最後的版本
monolog:
handlers:
streamed:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
emailed:
type: fingers_crossed
action_level: error
excluded_404s:
- ^/
handler: swift
swift:
type: swift_mailer
from_email: %noreply_email%
to_email: %webmaster_email%
subject: 'Error Notification %%message%%'
level: error
formatter: monolog.formatter.html
content_type: text/html
login:
type: stream
path: "%kernel.logs_dir%/auth.log"
level: info
channels: security
console:
type: console
感謝Xymanek現在我明白了,所以要記錄所有日誌和電子郵件僅錯誤不包括404。我將編輯我的問題以包含我的最終代碼,請查看它是否正確。 – ZeSoft
@ZeSoft你仍然需要包裝''一個一個fingers_crossed'裏面deduplicated'處理。 'excluded_404s'選項僅適用於手指交叉處理類型 – Xymanek
謝謝@Xymanek的回答,所以我編輯我上面的代碼和我刪除了重複數據刪除的處理程序,並直接分配迅速處理程序,以電子郵件的處理程序,它的好處是現在?類型重複數據刪除是什麼意思? – ZeSoft