Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Error Log Support #122

Open
JE4GLE opened this issue Oct 21, 2024 · 3 comments · Fixed by #126
Open

PHP Error Log Support #122

JE4GLE opened this issue Oct 21, 2024 · 3 comments · Fixed by #126

Comments

@JE4GLE
Copy link

JE4GLE commented Oct 21, 2024

Hey,

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

Thank you!

@JE4GLE
Copy link
Author

JE4GLE commented Oct 22, 2024

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
Copy link
Owner

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.

@frankdekker frankdekker reopened this Oct 23, 2024
@JE4GLE
Copy link
Author

JE4GLE commented Oct 23, 2024

The other documented error handlers didn't support multiline, so I had to use monolog. The downside was that some fields were required, so I had to add empty capture groups at the end: (?P<channel>.*)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants