I have a pretty common problem I think, but I can't find any "best practice" answer to it.
I developped a lot of small web apps based on a home made framework for my clients. Those apps are used only in a very specific business related context, they are used for something like a mounth in a year by an average of ten users.
Each app has a very diffrent purpose and "technology" behind it (sometimes it's Zend modules, TCPDF, etc...). Of course, once in a while users find some minor bugs (not handled exceptions, not set arrays ...).
The problem is, that users won't communicate about it for days or weeks, so when I have to debug, sometimes I don't have all the information I need (like, how to reproduce it, which route it was, etc ...).
For my home made framework (very Laravel-like) I made some functions that handles those errors (using set_error_handler, register_shutdown_function, ...). Basicly those function will create some log entry in client's MySQL database.
I use those functions for two purposes :
The only way I can analyse all these logs efficiently is when they are in a database (i have a JQuery table rendring them optimized for faster reading and tracking). Otherwise, i would just use text files, but I can't analyse them so fast (too much information).
Question
I just started a project with Laravel (which I'll be using for all my projects now), after some documentation reading I've found that Laravel uses Monolog for logs. BUT, Monolog don't have a PDO handler, some people may say that using MySQL for logs is a very bad idea (Can Laravel 4 log to a MySQL database?) and I totally agree with them. But it is the only way i've found to do efficient bug correction when working with a lot of small projects with a limited time to dedicate to it.
Note : My clients only have MySQL, I don't have the time to use unit testing (small company, no money for that).
Is there a better solution for my problem (log users activities AND php errors in a structured way, mail/SMS notification when errors are catched) using some Laravel magic I don't know about yet ?
Sure, there are number of tools that can monitor your log files for you and then collate them into meaningful information. They can group similar errors and provide you with detailed data on the kinds of requests that cause them. Better yet, you can elect to pass user data along with errors so you can see exactly what is causing issues.
Here are some that I've come across in my time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With