Skip to content

[5.7] Lenient log stacks - #27308

Merged
taylorotwell merged 1 commit into
laravel:5.7from
Propaganistas:5.7-lenient-log
Jan 28, 2019
Merged

[5.7] Lenient log stacks#27308
taylorotwell merged 1 commit into
laravel:5.7from
Propaganistas:5.7-lenient-log

Conversation

@Propaganistas

@Propaganistas Propaganistas commented Jan 25, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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