[FEATURE] Support autowired LoggerInterface injection
Logger instances may be required to be available during object construction, LoggerAwareInterface isn't an option in that case. Therefore LoggerInterface as constructor argument is now autowired (if the service is configured to use autowiring) and instantiated with an object-specific logger. We add a symfony compiler pass that prepares an inline factory which fetches the appropriate Logger instance from the LogManager. One of the TYPO3 core classes that require this is the Scheduler. Scheduler used to contain a safety net which fetches a logger instance from LogManager in case the logger is already needed during the constructor invocation. In that case the logger was not available, as it was injected via setter injection (setLogger) later (per LoggerAwareInterface). Releases: master Resolves: #95044 Change-Id: I57539a731a305da6abc092d2383e2d2f4c1d985c Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65449 Tested-by:core-ci <typo3@b13.com> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
Benjamin Franzke <bfr@qbus.de> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Nikita Hovratov <nikita.h@live.de> Reviewed-by:
Benjamin Franzke <bfr@qbus.de>
Showing
- typo3/sysext/core/Classes/DependencyInjection/LoggerInterfacePass.php 80 additions, 0 deletions.../core/Classes/DependencyInjection/LoggerInterfacePass.php
- typo3/sysext/core/Configuration/Services.php 1 addition, 0 deletionstypo3/sysext/core/Configuration/Services.php
- typo3/sysext/core/Documentation/Changelog/master/Feature-95044-SupportAutowiredLoggerInterfaceInjection.rst 40 additions, 0 deletions...eature-95044-SupportAutowiredLoggerInterfaceInjection.rst
- typo3/sysext/scheduler/Classes/Scheduler.php 4 additions, 11 deletionstypo3/sysext/scheduler/Classes/Scheduler.php
Please register or sign in to comment