feature #13320 [HttpKernel][2.7] Add request uri to Logger context (Rvanlaak)

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
This commit is contained in:
Fabien Potencier 2015-01-16 13:41:12 +01:00
commit e52daa3bd9
1 changed files with 4 additions and 1 deletions

View File

@ -140,7 +140,10 @@ class RouterListener implements EventSubscriberInterface
}
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_parameters' => $parameters,
'request_uri' => $request->getUri(),
));
}
$request->attributes->add($parameters);