Skip to content
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

Buffer handler not working as expected on php 5.3.10 #91

Closed
Shreef opened this issue Jun 14, 2012 · 5 comments
Closed

Buffer handler not working as expected on php 5.3.10 #91

Shreef opened this issue Jun 14, 2012 · 5 comments

Comments

@Shreef
Copy link
Contributor

Shreef commented Jun 14, 2012

The Buffer handler depends on the __destruct() method to push the buffered records to the sub-handler. looks like this doesn't always work on PHP 5.3.10 as destructors don't run on shutdowns caused by fatal errors.

the solution would require adding this line to the constructor of the AbstractHandler

register_shutdown_function(array($this, '__destruct'));
@Seldaek
Copy link
Owner

Seldaek commented Jun 14, 2012

It's not a bad idea, but I'm not sure if that would work very well, because then it keeps a reference to the object, which means it won't be destructed until the very end, and that means if it has any dependencies to be able to send the logs, it might just fail. I'd feel more comfortable adding that only to the buffer handler and not to the abstract one.

@Shreef
Copy link
Contributor Author

Shreef commented Jun 14, 2012

@Seldaek
Ok, makes sense

@stof
Copy link
Contributor

stof commented Jun 14, 2012

I would also register the close method directly instead of the magic function

@Shreef
Copy link
Contributor Author

Shreef commented Jun 14, 2012

Cool. I hope you can implement the solution and close the issue. if you need me to send a pull request or something, just let me know.

@Seldaek
Copy link
Owner

Seldaek commented Jun 14, 2012

@Shreef if you don't mind sending a PR, that'd be great.

Shreef added a commit to Shreef/monolog that referenced this issue Jun 14, 2012
Shreef added a commit to Shreef/monolog that referenced this issue Jun 14, 2012
…r won't get sent to the sub-handler twice
Seldaek added a commit that referenced this issue Jun 14, 2012
@Seldaek Seldaek closed this as completed Jun 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants