Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing log_errors_max_len has no effect

Tags:

php

I'm not experienced in PHP and I had problems logging out big arrays using error_log and print_r.

I was told here to change the log_errors_max_len of the php.ini file and I went ahead and did a <?php phpinfo(); ?> to see where the php.ini file was loaded from. Then I changed it to log_errors_max_len = 0 but still the output is truncated.

I'm also using Laravel.

Anybody has any idea why this is not working? (I already restarted apache :)

like image 588
Cotten Avatar asked Sep 02 '14 11:09

Cotten


1 Answers

The main thing here, is that log_errors_max_len seems pretty useless in this situation. PHP manual states that:

This length is applied to logged errors, displayed errors and also to $php_errormsg, but not to explicitly called functions such as error_log()

The only solution I was able to find so far is to use:

error_log("Long error message...", 3, CUSTOM_LOG_FILE);

The second parameter of error_log() allows you to redirect message to a custom file. So, the last parameter should be a path to a custom log file.

This way I'm getting full error message and, what might be more important for someone, non ASCII characters are clearly readable there (not sure though, might be my bad, but when I'm logging them with standard log file - I get things like \xd0\xbf).

like image 170
kumade Avatar answered Sep 29 '22 19:09

kumade