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

[Monolog] Really reset logger when calling logger::reset()#30410

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.2fromlyrixx:logger-reset
Mar 5, 2019

Conversation

@lyrixx
Copy link
Member

@lyrixxlyrixx commentedFeb 28, 2019
edited
Loading

QA
Branch?4.2
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

@lyrixx
Copy link
MemberAuthor

looks like Fabbot is broken.

Anyway, this patch is much better, because it actually does the work. BTW, introducing the methodreset() without calling the parent was a BC break, isn't ?

But it is still not perfect. ATM we rely on the fact that processors and handlers are shared among all loggers. But there is one logger per channel. So when we callLogger::reset(), we call it on only one logger. Not all!

Let me explain this a bit more. Let's consider this config:

monolog:handlers:main:type:fingers_crossedaction_level:errorhandler:bufferbuffer_size:50channels:["!php"]buffer:type:bufferhandler:filefile:type:streampath:'%kernel.logs_dir%/%kernel.environment%.log'php:type:fingers_crossedaction_level:errorhandler:php_filebuffer_size:50channels:["php"]php_file:type:streampath:'%kernel.logs_dir%/%kernel.environment%-php.log'

And with this PHP script:

<?phprequire__DIR__.'/vendor/autoload.php';$k =newAppKernel('dev',true);$k->boot();$c =$k->getContainer();// (I had to patch SF to make theses services public)$c->get('monolog.logger.php')->debug('debug from php - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');$c->get('monolog.logger.consumer')->debug('debug from consumer - YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY');$c->get('monolog.logger.consumer')->reset();dump(['logger php' =>$c->get('monolog.logger.php'),'logger consumer' =>$c->get('monolog.logger.consumer')]);

We can simulate our issue. In my consumer, I gotmonolog.logger.consumer logger. And when I callreset() it's well reset. But themonolog.logger.php is not reset :/

In my application, I don't have this issue because our configuration is more classical. But I know some people are doing this kind of configuration. We need to know that :)

joelwurtz and zmitic reacted with thumbs up emoji

@fabpot
Copy link
Member

Isn't it something we can do on 3.4?

@lyrixx
Copy link
MemberAuthor

@fabpot TheLogger::reset() did not exist in3.4. So I guess it's not possible as it would be a new feature. on 4.2 it's a bug fix.

@fabpot
Copy link
Member

Thank you@lyrixx.

@fabpotfabpot merged commit08a20ee intosymfony:4.2Mar 5, 2019
fabpot added a commit that referenced this pull requestMar 5, 2019
… (lyrixx)This PR was merged into the 4.2 branch.Discussion----------[Monolog] Really reset logger when calling logger::reset()| Q             | A| ------------- | ---| Branch?       | 4.2| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |Commits-------08a20ee [Monolog] Really reset logger when calling logger::reset()
@lyrixxlyrixx deleted the logger-reset branchMarch 5, 2019 09:46
@fabpotfabpot mentioned this pull requestApr 2, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

5 participants

@lyrixx@fabpot@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp