Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 790ba4c

Browse filesBrowse files
committed
feature #10534 [SwiftMailer] [MonologBundle] send error log mails from 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
2 parents 9dc14a5 + 9bb602f commit 790ba4c
Copy full SHA for 790ba4c

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed

‎src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Monolog\Handler;
1313

1414
use Monolog\Handler\SwiftMailerHandler as BaseSwiftMailerHandler;
15+
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
1516
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
1617

1718
/**
@@ -43,6 +44,16 @@ public function onKernelTerminate(PostResponseEvent $event)
4344
$this->instantFlush = true;
4445
}
4546

47+
/**
48+
* After the CLI application has been terminated we will always flush messages
49+
*
50+
* @param ConsoleTerminateEvent $event
51+
*/
52+
public function onCliTerminate(ConsoleTerminateEvent $event)
53+
{
54+
$this->instantFlush = true;
55+
}
56+
4657
/**
4758
* {@inheritdoc}
4859
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.