I’m trying to track down a very specific issue with an external API making requests to my server. How can I make changes to my exception handler so that request validation exceptions get logged in my error log file? Thanks in advance for any help.
I’m trying to track down a very specific issue with an external API making requests to my server. How can I make changes to my exception handler so that request validation exceptions get logged in my error log file? Thanks in advance for any help.
3
Answers
Thanks for all the answers, but I was able to find the answer here: https://stackoverflow.com/a/73066132/9980193
This was the method I added to Handler.php:
custom exceptions
doc laravel errors
Log::error(‘Validation Error: ‘ . $exception->getMessage());
Go to your
app/Exceptions/Handler.php
Edit the
register
method:Now whenever a validation error occurs, it will be written to your log without changing how it is reported to your end user.