change error log output format: ini_set('error_append_string', 'string') and ini_set('error_prepend_string', 'string') does nothing
This is what I tell php to do:
<?php error_reporting(E_ALL); ini_set('display_errors', '0'); ini_set('log_errors', 1); ini_set('error_log', 'errors.log'); ini_set('error_append_string', 'APP'); ini_set('error_prepend_string', 'PRE'); ?>
Hoping that I would get all errors reported in one file, with "PRE" before the message and "APP" after the message. (My goal is to make PRE and APP into /n /r or something...)
But my error reporting log looks like this:
[14-May-2013 00:16:26] PHP Notice: Undefined variable: nonexistentvariable in /home/www/dir/index.php on line 14[14-May-2013 00:16:28] PHP Notice: Undefined variable: nonexistentvariable in /home/www/dir/index.php on line 14
No PRE, no APP...
How do I get it in there, so that my error reporting file will have each error on a newline, rather than a loooong string of errors that's not helpful to me?
EDIT: So I noticed that with ini_set('display_errors', '1'); the "APP" and "PRE" strings are displayed on the page, in the error message.
That means I really need to find out where I can change the format for how php logs the errors. For example this whole timestamp thing - where is that specified?
EDIT: It is not possible to change the way php logs errors, you have to make your own error handler.
ANSWER: To truly achieve what I was going to, I asked a different question (to be more precise). How to change the way PHP writes errors in the error log file?
As the documentation says nothing to that, I have tested your example. I realized that error_append/prepend_string only works for displayed but not logged errors
My goal is to make PRE and APP into /n /r or something...
You should use a regex for that. Should be possible, as every log messages starts with nearly same prefix. Will prepare one....
check phpinfo(); after ini_sets