Application-based error logging / handling?

We have a web server on which we are going to run a number of applications. At the server level, we were able to handle error handling using Hyperic to notify the person responsible in the event of a / memcached database server failure.

However, we still need to handle these potential errors and log events that occur at the application level in order to improve the applications for our customers before customers find out.

So then what is a good solution for this?
Using your own PHP error log: it will be quickly blocked if we run a large number of applications at the same time. This is probably not the best option if you like the structure.

One idea is to create a lightweight off-site error handling application that has a REST / JSON API that receives encrypted and serialized arrays of error messages and stores them in a database. Perhaps this may be, depending on the severity of the error, also directly inserted into our error tracker.
Maybe a few hours spent, but it seems like a rather fragile solution, and I'm sure there are more reliable alternatives out there.

Thank,

+3
source share
4 answers

Why will using PHP error_log quickly become "cloggered"? If everything goes well, you won’t see many mistakes, right?

, API, , . , , / , , , .

, , .

+4

tail -f php , , . , ( ) , , / . , , (, var_export()/serialize() func_get_args() , . , .

Zend_Log, - (, , , , debug_backtrace(), , . , .., :)

: , , . , , , .

... , , , (Error-API/-Service ) : , , ? / ?

+2

set_exception_handler set_error_handler, , "". , , script ..

, . , , . ? ? ( )

+1

, , PHP: http://de.php.net/manual/en/ref.errorfunc.php

Of particular interest is set_error_handler (), which allows you to completely override the internal PHP error handler.

With this, you can create your own logs for each application / send emails to administrators / save error information in db / inform users that the administrator has been notified or something else.

By returning true or false, you can also control the internal PHP handlers. The internal error handler should start after your function or not.

+1
source

Source: https://habr.com/ru/post/1747872/


All Articles