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

[HttpKernel][2.7] Add request uri to Logger context #13320

Merged
merged 1 commit into from
Jan 16, 2015
Merged

[HttpKernel][2.7] Add request uri to Logger context #13320

merged 1 commit into from
Jan 16, 2015

Conversation

rvanlaak
Copy link
Contributor

@rvanlaak rvanlaak commented Jan 8, 2015

... so host info does not get lost in the logging. The current situation does not allow the user, that receives a Monolog email for instance, to determine at which host an error occurred.

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR -

@rvanlaak rvanlaak changed the title [HttpKernel] Add request uri to Logger context [HttpKernel][2.7] Add request uri to Logger context Jan 8, 2015
@@ -140,7 +140,8 @@ public function onKernelRequest(GetResponseEvent $event)
}

if (null !== $this->logger) {
$this->logger->info(sprintf('Matched route "%s"', $parameters['_route']), $parameters);
$logContext = $parameters + array('request-uri' => $request->getUri());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please distinguish route params and request uri, i.e. array('route-params' => $parameters, 'request-uri' => $request->getUri())

$logContext = array(
'route-params' => $parameters,
'request-uri' => $request->getUri(),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#13418 tries to make context more consistent. So, can you rename route-params to route_parameters and request-uri to request_uri? You can also inline the context instead of creating a temp var here. Thanks.

@fabpot
Copy link
Member

fabpot commented Jan 16, 2015

👍 after the minor renaming is done.

@rvanlaak
Copy link
Contributor Author

Fixed @fabpot will try to squash all commits in one

I've been looking for docs about logging and log parameter conventions, but couldn't find them.

@@ -140,7 +140,10 @@ public function onKernelRequest(GetResponseEvent $event)
}

if (null !== $this->logger) {
$this->logger->info(sprintf('Matched route "%s"', $parameters['_route']), $parameters);
$this->logger->info(sprintf('Matched route "%s"', $parameters['_route']), array(
'route_params' => $parameters,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer route_parameters as mentioned in my previous comment.

@stof
Copy link
Member

stof commented Jan 16, 2015

👍

... so host info does not get lost in the logging. The current situation does not allow the user to determine at which host an error occured.

| Q             | A
| ------------- | ---
| Bug fix?      | [no]
| New feature?  | [yes]
| BC breaks?    | [no]
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets |
| License       | MIT
| Doc PR        |

Fixed typo

Distinguish route-params from request-uri

Update context consistency

... and inline the context variable.

Rename `route_params` to `route_parameters`
@rvanlaak
Copy link
Contributor Author

Squashing all commits into one is done. Had to figure out PhpStorm 8.0.3 did not allow me to force a push, because the force option was missing.

@fabpot
Copy link
Member

fabpot commented Jan 16, 2015

Thank you @rvanlaak.

@fabpot fabpot merged commit c8f1f19 into symfony:2.7 Jan 16, 2015
fabpot added a commit that referenced this pull request Jan 16, 2015
…vanlaak)

This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel][2.7] Add request uri to Logger context

... so host info does not get lost in the logging. The current situation does not allow the user, that receives a `Monolog` email for instance, to determine at which host an error occurred.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | -

Commits
-------

c8f1f19 [HttpKernel] Add request uri to Logger context
@rvanlaak rvanlaak deleted the patch-1 branch January 17, 2015 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants