Commit 6684794
committed
feature #279 Flush loggers on kernel.reset (dnna)
This PR was squashed before being merged into the 3.x-dev branch (closes #279).
Discussion
----------
Flush loggers on kernel.reset
Fixes php-pm/php-pm-httpkernel#134 and php-pm/php-pm-httpkernel#62
When using [PHP-PM](https://github.com/php-pm/php-pm) the worker does not die at the end of the request, so the shutdown functions registered by monolog are never triggered (so for example `BufferHandler` never flushes). This PR partially fixes the problem by flushing the loggers containing a `flush` function at the end of each request.
I did not use the `close` function (mentioned in Seldaek/monolog#1053) because some loggers use sockets or other connections that would be closed in this case and not be reusable in the next request.
I'm not sure if this is the best solution to this problem, happy to discuss alternatives if there is a better way.
Commits
-------
366f692 Flush loggers on kernel.reset1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
156 | | - | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| |||
757 | 759 | | |
758 | 760 | | |
759 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
760 | 767 | | |
761 | 768 | | |
762 | 769 | | |
| |||
0 commit comments