changing log_errors_max_len has no effect

前端 未结 2 1616
一向
一向 2021-01-18 08:40

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 chan

相关标签:
2条回答
  • 2021-01-18 08:45

    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).

    0 讨论(0)
  • 2021-01-18 09:08

    Make sure to set the configuration at the top of your page like this.

    <?php
    ini_set("log_errors_max_len", 0);
    ?>
    

    See also this question. Might it be the issue you have?

    0 讨论(0)
提交回复
热议问题