-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DX] Attempt to improve logging messages with parameters #13418
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
@@ -67,7 +67,7 @@ public function handle(GetResponseEvent $event) | |||
} | |||
|
|||
if (null !== $this->logger) { | |||
$this->logger->info(sprintf('Basic Authentication Authorization header found for user "%s"', $username)); | |||
$this->logger->info(sprintf('Basic authentication Authorization header found for user "%s"', $username)); |
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.
What about moving the username as well (same below.) The more static the message is, the better for log aggregators.
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.
I wasn't sure as in many cases the message would become borked. I agree that it would be a better solution.
Edit, I can leave the username in the message and add it to the context.
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.
"Basic authentication Authorization header found" is enough I think.
@stof @fabpot I have processed the remarks. While at it, I want to add or remove the trailing |
Seems like a flaky test is making this build fail:
|
I would add dots everywhere (which is what we do for exception messages). |
Dots added and tests updated. |
👍 |
Thank you @iltar. |
…n logging it. (Koc) This PR was merged into the 2.7 branch. Discussion ---------- [DX] Fixed regression when exception message swallowed when logging it. | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | maybe, wait for Travis | Fixed tickets | fixed regression introduced in #13418 | License | MIT | Doc PR | - The problem is: after merging referenced PR we cann't understand what error occured and why authentication request failed (see attached screenshot). Previously it displays exception message, but now it only displays class of the exception.  Commits ------- 042cb6b Fixed regression when exception message swallowed when logging it.
This PR is a follow-up of #12594
[DX] [HttpKernel] Use "context" argument when logging route in RouterListener
.I have attempted to improve the log messages, as well as updating the usage context. I wasn't sure if the log messages should end with a
.
or not, if so I can update all messages to confirm a standard.