PHP Monolog Choking on Large Log Entries

I’m using Monolog to log XML coming into a SOAP service and some of the XML is really long. I’m using a LineLogParser and it’s calling preg_match to parse each line of the log. Well on the big XML files, preg_match was hitting a “backtrack” limit.

What I had to do was crank up the value for pcre.backtrack-limit until it was able to parse the log lines with large XML in them. The downside of doing this is that cranking that setting too high can crash PHP.

Another solution would be to rewrite my parser to handle these particular logs differently, but for now, this is working for me.

Share Button