M
M
Maxim Lagoysky2019-12-04 12:52:31
symfony
Maxim Lagoysky, 2019-12-04 12:52:31

How to set up monolog in symfony to send emails?

Good day everyone, there is such a problem, I'm setting up logging according to off-line documentation from the symphony website. I write the settings in the config and put throw new Exception () in the action, in theory the page catches a 500 error and a letter with a critical error should come, but nothing comes. If there are methods in the project that send mail and they work fine, what could be the problem? Tried both in dev and prod modes. The logs are written to the file like normal.

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: critical
            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:   'email_from'
            to_email:     'email_to'
            subject:      'An Error Occurred! %%message%%'
            level:        debug
            formatter:    monolog.formatter.html
            content_type: text/html

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question