The PHP log format does not include the date, for Warnings. For instance
PHP Warning: Cannot modify header information...
does not have any date of when the warning happened.
Is there a way to change the Warning format, or at least have the date in the log? (usingphp-fpm
if it matters).
You can of course always define your own error handler using set_error_handler
. Simplified example:
function handler($errno, $errstr, $errfile, $errline, $errcontext) {
$message = date('Y-m-d H:i:s') . ": $errstr in $errfile at $errline\n";
file_put_contents('error.log', $message, FILE_APPEND);
}
set_error_handler('handler');
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