Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit790ba4c

Browse 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 | MITGiven I have symfony2 application with Monolog configured to send mail on error logs.When I have exception thrown from CLI taskThen I should receive error mailHowever 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 withsymfony/monolog-bundle#73Commits-------9bb602f added explicit swiftmailer flush after ConsoleEvents::TERMINATE
2 parents9dc14a5 +9bb602f commit790ba4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespaceSymfony\Bridge\Monolog\Handler;
1313

1414
useMonolog\Handler\SwiftMailerHandlerasBaseSwiftMailerHandler;
15+
useSymfony\Component\Console\Event\ConsoleTerminateEvent;
1516
useSymfony\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+
publicfunctiononCliTerminate(ConsoleTerminateEvent$event)
53+
{
54+
$this->instantFlush =true;
55+
}
56+
4657
/**
4758
* {@inheritdoc}
4859
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp