-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Strip exception file paths from log messages #46828
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe only strip the project dir ...
That's a bit more complicated solution, but sure we could that too if you think it's better. Any other opinions? edit: Also I think that's a bit more error prone too, because I don't think there is a guarantee kernel.project_dir will always resolve to a real path and not a symlink. |
Could you please provide an example before and after the file path has been cleaned? What if users have classes with the same name (
We use Sentry and it doesn't have this issue, it looks like it groups errors by the relative path, e.g. Maybe this can be configured on the side of NewRelic? |
Before:
This can happen, but is very unlikely, especially at the same line
What does this mean? Same log entry that's having that message also has full context and trace. No log digging is necessary, you just expand current log. And for that matter, I don't see why is symfony even putting file and line in log message at all. Other logs that don't go through this listener don't have this info and I haven't seen anyone complaining. If people think this is good idea in general, monolog should do this itself via processor.
No, their support told me this
You probably use Sentry bundle which uses error listener. In our case, we hook into Monolog handler and send all error logs to NR, not only errors caught by error listener. |
Any update? Or shall we simply stop adding file path and line in the log message? |
Works for me, but please keep the CS: we prefer one liners (they help with grep) |
6a0b0c9
to
272c13e
Compare
CS adjusted, rebased |
Thank you @ostrolucky. |
In log messages, I would like to strip full file path to a file where error occurred. Instead, I suggest to use name of the file only. There are 2 reasons:
app/releases/385
/ ->/app/releases/386/
and so on). SinceException::getFile()
contains real path and not symlink path (/app/current/
), every release log messages for exact same errors change. This causes error deduplication of 3rd parties like NewRelic and other APM solutions to not trigger, which means we are getting alerts for same old errors after every release.