すべてのメッセージをログファイルに記録したいが、エラーが発生した場合は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は今、私はログインするすべてのものと電子メールのみのエラーを記録し、理解私の最終的なコードを含めるように私の質問を編集します、それが正しいかどうか見てください。 – ZeSoft
@ ZeSoftあなたは 'deduplicated'ハンドラを' fingers_crossed'ハンドラでラップする必要があります。 'excluded_404s'オプションはハンドラーのタイプにのみ対応します – Xymanek
あなたの答えは@Xymanekですので、上記のコードを編集して重複除外ハンドラーを削除し、電子メールハンドラーに直接ハンドラーを直接割り当てました。タイプ重複除外とは何を意味しますか? – ZeSoft