frankdekker / symfony-log-viewer-bundle

A log viewer for Symfony
MIT License
16 stars 2 forks source link

PHP Error Log Support #122

Open JE4GLE opened 1 day ago

JE4GLE commented 1 day ago

Hey,

I think it would be nice to support the PHP error log.

Thank you!

JE4GLE commented 12 hours ago

Hey, thank you for the quick implementation. I think, php error logs can include multiline entries with stack traces. Here is my temporary config to make it work with the monolog handler:

start_of_line_pattern: '/^\[\d{2}-[a-zA-Z]{3}-\d{4} \d{2}:\d{2}:\d{2} [a-zA-Z]+\/[a-zA-Z]+]/'
        log_message_pattern: '/^\[(?P<date>[^\]]+)\]\s(?P<severity>[^:]+):\s(?P<message>[^\n\/]+) (?P<context>[^\n]*)\n(?P<extra>.*)?(?P<channel>.*)/s'
        date_format: "d-M-Y H:i:s e"
frankdekker commented 3 hours ago

Hey, i'll test some with the stack trace and will add the start_of_line_pattern if needed.

The combination with the error_log + monolog handler seems more specific scenario. I can't assume error_log will only be used via monolog. I'll add an example to the documentation for this.