Laravel Database Log is best practice

I have a fairly common problem I think, but I cannot find a "best practice" answer.

I have developed many small home infrastructure based web applications for my clients. These apps are only used in a very specific business context, they are used for something like a month a year with an average of ten users.

Each application has a very different purpose and the "technology" behind it (sometimes Zend modules, TCPDF, etc.). Of course, from time to time users find some minor bugs (no exceptions being handled, no arrays given ...).

The problem is that users won't report this 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 was, etc.) ).

For my home structure (very similar to Laravel), I made some functions that handle these errors (using set_error_handler, register_shutdown_function, ...). Basically these functions will create some record in the client's MySQL database.

I use these functions for two purposes:

  • Log user actions and errors php + context (routes, controllers, some data flow, predefined php variables, ...)
  • Warn me when something goes wrong (by mail, SMS, etc.).

The only way to analyze all of these logs efficiently is when they are in the database (I have a jQuery table making it easier to optimize them for faster reading and tracking). Otherwise, I would just use text files, but I cannot parse them quickly (too much information).

Question

I just started a project with Laravel (which I will be using for all my projects now), after reading some documentation I found that Laravel uses Monolog for logs. BUT, Monologue has no PDO handler, some people might say that using MySQL for logs is a very bad idea ( Can Laravel 4 log to MySQL database? ) And I totally agree with them. But this is the only way I've found effective error correction when dealing with a lot of small projects with limited time to devote to.

Note. My clients only have MySQL, I don't have time to use unit testing (small company, no money for that).

Is there a better solution for my problem (logging user actions and php errors in a structured way, email / SMS notification when errors are hit) using some Laravel magic that I am not aware of yet?

+3


source to share


1 answer


Of course, there are many tools out there that can keep track of your log files for you, and then collect them into meaningful information. They can group similar errors and provide details about the types of requests that cause them. Better yet, you can choose to transfer user data along with errors so you can see exactly what is causing the problem.

Here are some of them that I met in due time



+2


source







All Articles