Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Closed
wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Dec 27, 2016

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets symfony/monolog-bundle#165
License MIT
Doc PR

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.

@xabbuh
Copy link
Member Author

xabbuh commented Dec 27, 2016

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 $skipOnCli property introduced in this PR.

*/
public function isHandling(array $record)
{
if ($this->skipOnCli && php_sapi_name() === 'cli') {
Copy link
Contributor

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.

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@xabbuh xabbuh force-pushed the monolog-bundle-165 branch from d9faef8 to 716ff25 Compare December 27, 2016 13:16
@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Dec 27, 2016
{
parent::__construct($level, $bubble);

if (func_num_args() >= 3) {
Copy link
Member

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 ?

Copy link
Member Author

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.

stof added a commit to symfony/monolog-bundle that referenced this pull request Jan 2, 2017
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
@xabbuh
Copy link
Member Author

xabbuh commented Jan 4, 2017

ping @symfony/deciders We now need this or something similar to fix symfony/monolog-bundle#165 as symfony/monolog-bundle#195 has been merged.

@nicolas-grekas
Copy link
Member

This approache reduces the usefulness of the class, it makes things context sensitive. I think I'm 👎 for this reason.
I could very well decide to serve HTTP via CLI and use DebugHandler. But this would prevent it completely.

@xabbuh
Copy link
Member Author

xabbuh commented Jan 6, 2017

@nicolas-grekas Got that, but then we would need to find an alternative way to solve symfony/monolog-bundle#165.

@nicolas-grekas
Copy link
Member

What about allowing one to configure a limit on the number of kept records, FIFO style?

@nicolas-grekas
Copy link
Member

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 ?
then we would just have to set this env var only for console apps
either in bin/console, or maybe in Application?

@nicolas-grekas nicolas-grekas removed their request for review July 6, 2017 14:57
@nicolas-grekas
Copy link
Member

I suggest to close and replace by an issue...

@nicolas-grekas
Copy link
Member

Replaced by issue #25876

@xabbuh xabbuh deleted the monolog-bundle-165 branch January 22, 2018 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants