Search code examples
phpapachestack-traceerror-loggingerror-log

How to make apache error log entries longer


I'm sending some rather long stack traces to the apache error log using php's 'error_log()' and the entries are getting truncated. I have not found a way to make entries longer. Any ideas?


Solution

  • As Leopoldo said, setting log_errors_max_len seems pretty useless in this situation, and PHP manual states this clearly.

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