I use set_error_handler to override the default PHP error handling for the sole purpose of setting up error logging. but I came to the conclusion that simply cannot be configured error log and log all possible errors.
1) You can use set_error_handler () - but this function, quote from the php manual:
The following types of errors cannot be handled by a user-defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING and most E_STRICT
So - going this route - your custom log will not log these errors?
2) The second way is to use register_shutdown_function()
and then run error_get_last()
to get the error ... But - error_get_last()
... only gets the last error ... and although you may have some warnings and notifications in script runtime - this approach will allow you to log the most recent error, notification, warning - right?
So - IMHO - I see no way around this. It seems like if you want to have the most comprehensive error log - you just need to stick with php logger by default - right?
Stann source share