mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-27 00:25:50 +03:00
[GH-ISSUE #1219] Output to Browser #510
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#510
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ChristianFranke on GitHub (Nov 6, 2018).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1219
I'm using monolog successfully, but in case of unhandled PHP errors (e.g. Warning: Division by zero) this error message still appears in the browser.
Of course I can deactivate errors in the browser with display_errors = 0, but I would prefer an "anonymous" error message to be sent to the browser (e.g. "we are already on it"). I can overwrite this error message with set_error_handler, but then monolog doesn't get the error anymore - or do I see it wrong?
Another idea would be to write an echoHandler for monolog, but then PHP would still issue the error message.
What's the best practice here? Thanks for your answer!
@Seldaek commented on GitHub (Nov 19, 2018):
This is typically handled by the framework (responding with an error page when an unhandled error occurs). The best practice is definitely to run production with display_errors=0 because otherwise you might leak sensitive information to the user.
How exactly you go about rendering a page I am not sure, depends on how your application is built really, but I would say this shouldn't really be monolog's responsibility, as it's about reporting an error to the user and not about logging for devs. The goal is different and the information conveyed as well.