Skip to content

Commit cc8d4ed

Browse files
[HttpKernel] Add #[WithLogLevel] attribute
1 parent 740e44f commit cc8d4ed

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

reference/configuration/framework.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,6 +3630,23 @@ to the ``#[WithHttpStatus]`` attribute on the exception class::
36303630

36313631
The ``#[WithHttpStatus]`` attribute was introduced in Symfony 6.3.
36323632

3633+
It is also possible to map a log level on a custom exception class using
3634+
the ``#[WithLogLevel]`` attribute::
3635+
3636+
namespace App\Exception;
3637+
3638+
use Psr\Log\LogLevel;
3639+
use Symfony\Component\HttpKernel\Attribute\WithLogLevel;
3640+
3641+
#[WithLogLevel(LogLevel::WARNING)]
3642+
class CustomException extends \Exception
3643+
{
3644+
}
3645+
3646+
.. versionadded:: 6.3
3647+
3648+
The ``#[WithLogLevel]`` attribute was introduced in Symfony 6.3.
3649+
36333650
.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
36343651
.. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
36353652
.. _`PhpStormProtocol`: https://github.com/aik099/PhpStormProtocol

0 commit comments

Comments
 (0)