-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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.5] Exception Handler Improvement in report() #19698
[5.5] Exception Handler Improvement in report() #19698
Conversation
- altered Exception handler to log message as first parameter - exception as 2nd parameter in 'exception' key
I feel like this would be a big change for a lot of people who just use the default log files to look at stack traces, etc, which would no longer be available. |
You may be right, perhaps there is a middle ground I can find... Would you be interested in this behavior being configurable/opt-in? Another Thought: what if the first parameter was not The unfortunate nature of Monolog is that processors happen after As it happens, (and this is not meant to be critical in the least of the current strategy) Monolog really wants that (edit: you can still expect Exceptions to be coerced even though the library uses |
Something else to consider- monolog does have this as a configurable thing in the LineFormatter (see |
Another option may be to have a new protected method |
- ensure line formatter prints stack trace
- updated lowest monolog to ~1.12
The most recent commit demonstrates a potential strategy that meets the goal of having the stacktraces in the new laravel/laravel project's default log files. Attached is a screenshot of what you can expect (this triggered from a As a sidenote, I am less interested in the protected method route. Our workflow for new in-house apps is such that we start with a |
Looks good, thanks. |
Several monolog handlers (and logging services) have first class support for logging exceptions. (New relic for example: https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/NewRelicHandler.php#L88) They are all consistent in that they expect the exception in the context at the key
'exception'
. Additionally, it would be more user friendly to not have an exception (along with the whole large stacktrace) stringified in the message.Tests are included, I am not sure what other expectations there are for logging exception in the laravel skeleton and other products. Thanks.