Skip to content

Commit acc618f

Browse files
committed
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
2 parents e414f41 + bc1b36b commit acc618f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

EventListener/RouterListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ public function onKernelRequest(GetResponseEvent $event)
140140
}
141141

142142
if (null !== $this->logger) {
143-
$this->logger->info(sprintf('Matched route "%s"', $parameters['_route']), $parameters);
143+
$this->logger->info(sprintf('Matched route "%s"', $parameters['_route']), array(
144+
'route_parameters' => $parameters,
145+
'request_uri' => $request->getUri(),
146+
));
144147
}
145148

146149
$request->attributes->add($parameters);

0 commit comments

Comments
 (0)