[GH-ISSUE #12] improve error reporting for inexisting handler type #2

Closed
opened 2026-03-04 02:11:14 +03:00 by kerem · 2 comments
Owner

Originally created by @dbu on GitHub (Apr 12, 2011).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/12

when i set the handler for a logger to a not existing one, i get a fatal exception that is confusing. the best would be an exception along "Did not find the handler you specified: $type. Available handlers are: ... . If you are adding your own handler, define the property monolog.handler.XXX.class."

PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The parameter "monolog.handler.fingers_crossed_whatever.class" must be defined.' in /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:77
Stack trace:
#0 /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(141): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get('monolog.handler...')
#1 /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php(99): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue('%monolog.handle...')
#2 /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php(83): Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass->resolveString('%monolog.handle...')
#3 /home/david/tmp/cmf-sandbox/vendor/s in /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 77

Originally created by @dbu on GitHub (Apr 12, 2011). Original GitHub issue: https://github.com/Seldaek/monolog/issues/12 when i set the handler for a logger to a not existing one, i get a fatal exception that is confusing. the best would be an exception along "Did not find the handler you specified: $type. Available handlers are: ... . If you are adding your own handler, define the property monolog.handler.XXX.class." PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The parameter "monolog.handler.fingers_crossed_whatever.class" must be defined.' in /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:77 Stack trace: #0 /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(141): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get('monolog.handler...') #1 /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php(99): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue('%monolog.handle...') #2 /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php(83): Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass->resolveString('%monolog.handle...') #3 /home/david/tmp/cmf-sandbox/vendor/s in /home/david/tmp/cmf-sandbox/vendor/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 77
kerem closed this issue 2026-03-04 02:11:14 +03:00
Author
Owner

@Seldaek commented on GitHub (Apr 12, 2011):

This is actually a Symfony issue in MonologBundle, but I'll keep this open here until it's fixed.

<!-- gh-comment-id:989090 --> @Seldaek commented on GitHub (Apr 12, 2011): This is actually a Symfony issue in MonologBundle, but I'll keep this open here until it's fixed.
Author
Owner

@dbu commented on GitHub (Apr 12, 2011):

ups, sorry, of course. still not totally wrapped my brain around the implications of clear separation. (although it is very well done :-)

<!-- gh-comment-id:989431 --> @dbu commented on GitHub (Apr 12, 2011): ups, sorry, of course. still not totally wrapped my brain around the implications of clear separation. (although it is very well done :-)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#2
No description provided.