-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SwiftMailer] send error log mails from CLI #73
[SwiftMailer] send error log mails from CLI #73
Conversation
@@ -341,6 +341,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler | |||
if (!$oldHandler) { | |||
$this->swiftMailerHandlers[] = $handlerId; | |||
$definition->addTag('kernel.event_listener', array('event' => 'kernel.terminate', 'method' => 'onKernelTerminate')); | |||
$definition->addTag('kernel.event_listener', array('event' => 'console.terminate', 'method' => 'onCliTerminate')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be wrapped in a if (method_exists($newHandlerClass, 'onCliTerminate'))
to make sure the symfony version is recent enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Seldaek
right you are
Updated code and set BC break
to no
Alright thanks, I'll merge whenever it gets merged in symfony, in case something would change in the meantime. |
…m CLI (arodiss) This PR was merged into the 2.5-dev branch. Discussion ---------- [SwiftMailer] [MonologBundle] send error log mails from CLI | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Given I have symfony2 application with Monolog configured to send mail on error logs. When I have exception thrown from CLI task Then I should receive error mail However this is not true because `Monolog/SwiftMailerHandler` is doing force flush only on `kernel.terminate`, but not on `console.terminate` This PR fixes issue together with symfony/monolog-bundle#73 Commits ------- 9bb602f added explicit swiftmailer flush after ConsoleEvents::TERMINATE
@Seldaek |
[SwiftMailer] send error log mails from CLI
Thanks |
Given I have symfony2 application with Monolog configured to send mail on error logs.
When I have exception thrown from CLI task
Then I should receive error mail
However this is not true because
Monolog/SwiftMailerHandler
is doing force flush only onkernel.terminate
, but not onconsole.terminate
This PR fixes issue together with symfony/symfony#10534