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

Including the log message content in the Exception when StreamHandler::write() fails #1630

Closed
ivanhoe011 opened this issue Jan 25, 2022 · 1 comment
Labels
Milestone

Comments

@ivanhoe011
Copy link

ivanhoe011 commented Jan 25, 2022

Currently when StreamHandler::write() fails to open the stream it will throw either a LogicException or UnexpectedValueException with a generic error message, but the log message that we wanted to write to the log will be completely lost in the process. That can be super frustrating, you screw up log permissions without noticing and then days later you see something bad happened but have no idea what, as the log write failed and exception message says just something generic like "Failed to open stream: Permission denied". IMHO dumping the log message as an additional part of the exception would improve the user experience a lot.

So, tl;dr; would it be possible to, on exception in StreamHandler::write(), just to append (string) $record['formatted'] to the end of the exception message as an extra piece of info?

@Seldaek Seldaek added this to the 2.x milestone Mar 7, 2022
@Seldaek
Copy link
Owner

Seldaek commented Mar 7, 2022

That kinda makes sense yes, but I guess the same logic should be applied to more than just StreamHandler then..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants