8000 [HttpKernel][DX] Allow the log level of http exceptions to be overridden by mtibben · Pull Request #25533 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel][DX] Allow the log level of http exceptions to be overridden #25533

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

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add param for setting log levels in DI
  • Loading branch information
mtibben committed Jan 19, 2018
commit 367e68e640128c5d76d14ee2f436e46d9b44684d
1 change: 1 addition & 0 deletions src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<tag name="monolog.logger" channel="request" />
<argument>%twig.exception_listener.controller%</argument>
<argument type="service" id="logger" on-invalid="null" />
<argument>%twig.exception_listener.http_status_codes_log_level%</argument>
</service>

<service id="twig.controller.exception" class="Symfony\Bundle\TwigBundle\Controller\ExceptionController" public="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ class ExceptionListener implements EventSubscriberInterface
protected $logger;
protected $httpStatusCodeLogLevel = array();

public function __construct($controller, LoggerInterface $logger = null)
public function __construct($controller, LoggerInterface $logger = null, $httpStatusCodeLogLevel = array())
{
$this->controller = $controller;
$this->logger = $logger;
if ($httpStatusCodeLogLevel && is_array($httpStatusCodeLogLevel)) {
$this->httpStatusCodeLogLevel = $httpStatusCodeLogLevel;
}
}

public function logKernelException(GetResponseForExceptionEvent $event)
Expand Down
0