Skip to content

Commit

Permalink
bug #54032 [SecurityBundle] Use "event" monolog channel in traceable …
Browse files Browse the repository at this point in the history
…firewall event dispatcher (danielburger1337)

This PR was squashed before being merged into the 7.1 branch.

Discussion
----------

[SecurityBundle] Use "event" monolog channel in traceable firewall event dispatcher

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | n/a
| License       | MIT

I think since #49021 was merged, security events in debug mode are logged inside the "app" (default) channel.

This is very annoying in an API use case as every request generates about 10 _useless_ log entries.

This PR changes the monolog channel of the traceable event dispatcher to `event` and also tags it with `kernel.reset`. This matches the behavior of `debug.event_dispatcher`.

Commits
-------

3995c71 [SecurityBundle] Use "event" monolog channel in traceable firewall event dispatcher
  • Loading branch information
fabpot committed Mar 17, 2024
2 parents 0df5901 + 3995c71 commit 394d6b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -50,7 +50,9 @@ public function process(ContainerBuilder $container): void
new Reference('debug.stopwatch'),
new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE),
new Reference('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE),
]);
])
->addTag('monolog.logger', ['channel' => 'event'])
->addTag('kernel.reset', ['method' => 'reset']);
}

foreach (['kernel.event_subscriber', 'kernel.event_listener'] as $tagName) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/SecurityBundle/SecurityBundle.php
Expand Up @@ -104,6 +104,6 @@ public function build(ContainerBuilder $container): void
)));

// must be registered before DecoratorServicePass
$container->addCompilerPass(new MakeFirewallsEventDispatcherTraceablePass(), PassConfig::TYPE_OPTIMIZE, 10);
$container->addCompilerPass(new MakeFirewallsEventDispatcherTraceablePass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
}
}

0 comments on commit 394d6b4

Please sign in to comment.