I have a portal being used by a lot of people. At times, people complain that they face 'server error 500' in the middle of browsing the portal. But this is random, and if/when I investigate by opening the page, it is almost always working fine. This normally means that coding is not really at fault (because else the error would come all the time). I have also checked server load conditions, which is also comfortable. I also checked apache logs, and server error 500 is surely there.
I intend to troubleshoot the issue somehow. In apache logs, I only see the page access and server response. For troubleshooting, I would need environment variables as well. Also, there are some POST variables, so I would like to need that as well.
Is there a way to capture these logs/traces for analyzing the issue and find the root cause. Does Laravel framework offer some help in this regard?
Error 500 is often caused by a code logic error. So don't rule out your code. There must be some kind of pattern your users are following that you don't. Can your users retrace the steps they took to encounter that error ? That would help you out. Also, the error would be more verbose in a local environment. It will tell you what was the stack of operations and what failed.
It's a problem to get info from the users because they are less IT educated. Also I don't want to open the debug trace for the users due to security reasons. So it is kind of a problem to recreate the issue somehow, which is not easy to do because when I open the page, it works fine. That's why looking for some log tracing :-)
@saadaan but on your server logs, either apache or storage/logs in laravel you are getting just a 500?
It should be a full stack trace giving you steps so you can track a bit where does the error appears. But you won't get the user input unfortunately so you know exactly what is going on.
There are many paid services that you can use. One of the best and really Laravel oriented is flare