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

[5.7] Lenient log stacks #27308

Merged
merged 1 commit into from
Jan 28, 2019
Merged

[5.7] Lenient log stacks #27308

merged 1 commit into from
Jan 28, 2019

Conversation

Propaganistas
Copy link
Contributor

@Propaganistas Propaganistas commented Jan 25, 2019

A simple yet powerful addition to the stack log driver: whenever a log stack is marked as lenient, the stack gets wrapped in the WhatFailureGroupHandler. Taken from Monolog's documentation:

This handler extends the GroupHandler ignoring exceptions raised by each child handler. This allows you to ignore issues where a remote tcp connection may have died but you do not want your entire application to crash and may wish to continue to log to other handlers.

So in this case log handlers throwing exceptions themselves are gracefully ignored, allowing the stack to continue. Highly useful to prevent white screens in production when for instance Slack cannot be reached.

I had a hard time choosing the right keyword (lenient, tolerant, continue, ignore_exceptions, ...), so please adjust as desired.

Disclaimer: I know this can be accomplished by tapping into the Monolog instance (tap) and rebinding the handler, but since it is such a useful thing I figured suggesting it as a config would be appropriate and helpful to many that are unaware of the possibility.

@taylorotwell
Copy link
Member

Lol... that's a great class name from Monolog :)

@taylorotwell taylorotwell merged commit 8999f5e into laravel:5.7 Jan 28, 2019
@taylorotwell
Copy link
Member

Renamed option to ignore_exceptions.

@Propaganistas Propaganistas deleted the 5.7-lenient-log branch January 28, 2019 15:15
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

Successfully merging this pull request may close these issues.

2 participants