-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[MonologBridge] skip DebugHandler on CLI to prevent OOM errors #21061
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
Conversation
Please not that both PRs do not solve symfony/monolog-bundle#165 (comment). For that we would probably have to introduce a new config option in MonologBundle that would allow to customise the |
*/ | ||
public function isHandling(array $record) | ||
{ | ||
if ($this->skipOnCli && php_sapi_name() === 'cli') { |
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.
The php_sapi_name() === 'cli'
can also be done in the constructor with the skipOnCli
property.
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.
should use the PHP_SAPI
const btw
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.
fixed
d9faef8
to
716ff25
Compare
{ | ||
parent::__construct($level, $bubble); | ||
|
||
if (func_num_args() >= 3) { |
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.
why not using a real argument ?
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.
I am not sure that we need to expose this option. It's only here to be able to run the tests for the class in the CLI environment.
This PR was merged into the 2.x branch. Discussion ---------- revert disabling DebugHandler in CLI environments As the cache is shared between the different server APIs, the debug handler needs to take care of abstaining itself. After symfony/symfony#21061 being merged, the changes made in fbbcefd should no longer be necessary. Commits ------- 79ed24b revert disabling DebugHandler in CLI environments
ping @symfony/deciders We now need this or something similar to fix symfony/monolog-bundle#165 as symfony/monolog-bundle#195 has been merged. |
This approache reduces the usefulness of the class, it makes things context sensitive. I think I'm 👎 for this reason. |
@nicolas-grekas Got that, but then we would need to find an alternative way to solve symfony/monolog-bundle#165. |
What about allowing one to configure a limit on the number of kept records, FIFO style? |
what about making the DebugHandler sensitive to an env var / or using an env var to define a new "$skip" argument if this is a service that can use the env vars as read by the container ? |
I suggest to close and replace by an issue... |
Replaced by issue #25876 |
This fixes symfony/monolog-bundle#165 in a way that allows to revert symfony/monolog-bundle@fbbcefd (see symfony/monolog-bundle#195 for the reverting change) which prevented the container from being built properly leading to missing logs in the profiler.