Skip to content

Commit 43867cf

Browse files
[HttpKernel] Add #[WithLogLevel] attribute
1 parent f8f0f7c commit 43867cf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

reference/configuration/framework.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,6 +3611,25 @@ use the configuration of the first exception that matches ``instanceof``:
36113611
log_level: 'debug'
36123612
status_code: 422
36133613
3614+
It is also possible to map a log level on a custom exception class using the
3615+
``#[WithLogLevel]`` attribute::
3616+
3617+
<?php
3618+
3619+
namespace App\Exception;
3620+
3621+
use Psr\Log\LogLevel;
3622+
use Symfony\Component\HttpKernel\Attribute\WithLogLevel;
3623+
3624+
#[WithLogLevel(LogLevel::WARNING)]
3625+
class CustomException extends \Exception
3626+
{
3627+
}
3628+
3629+
.. versionadded:: 6.3
3630+
3631+
The ``#[WithLogLevel]`` attribute was introduced in Symfony 6.3.
3632+
36143633
.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
36153634
.. _`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
36163635
.. _`PhpStormProtocol`: https://github.com/aik099/PhpStormProtocol

0 commit comments

Comments
 (0)