From 2b5d33817b91b8d65d4ef4b774c18dcb3403b49e Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:37:55 +0100 Subject: [PATCH] TASK: Introduce dedicated `contentRepositoryLogger` --- .../Classes/ContentRepository.php | 2 +- .../Classes/ContentRepositoryRegistry.php | 4 +++- .../Configuration/Objects.yaml | 9 +++++++++ .../Configuration/Settings.yaml | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Neos.ContentRepository.Core/Classes/ContentRepository.php b/Neos.ContentRepository.Core/Classes/ContentRepository.php index 43534f3100d..09ee8642405 100644 --- a/Neos.ContentRepository.Core/Classes/ContentRepository.php +++ b/Neos.ContentRepository.Core/Classes/ContentRepository.php @@ -55,7 +55,7 @@ * * @api */ -final readonly class ContentRepository +final class ContentRepository { /** * @internal use the {@see ContentRepositoryFactory::getOrBuild()} to instantiate diff --git a/Neos.ContentRepositoryRegistry/Classes/ContentRepositoryRegistry.php b/Neos.ContentRepositoryRegistry/Classes/ContentRepositoryRegistry.php index fc75a43629b..5ffe1c220b7 100644 --- a/Neos.ContentRepositoryRegistry/Classes/ContentRepositoryRegistry.php +++ b/Neos.ContentRepositoryRegistry/Classes/ContentRepositoryRegistry.php @@ -57,6 +57,9 @@ final class ContentRepositoryRegistry */ private array $factoryInstances = []; + #[Flow\Inject(name: 'Neos.ContentRepositoryRegistry:Logger', lazy: false)] + protected LoggerInterface $logger; + /** * @param array $settings */ @@ -64,7 +67,6 @@ public function __construct( private readonly array $settings, private readonly ObjectManagerInterface $objectManager, private readonly SubgraphCachePool $subgraphCachePool, - private readonly LoggerInterface $logger, ) { } diff --git a/Neos.ContentRepositoryRegistry/Configuration/Objects.yaml b/Neos.ContentRepositoryRegistry/Configuration/Objects.yaml index df582d41eba..f41e1e795aa 100644 --- a/Neos.ContentRepositoryRegistry/Configuration/Objects.yaml +++ b/Neos.ContentRepositoryRegistry/Configuration/Objects.yaml @@ -14,3 +14,12 @@ Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalContentGraphProjectionFactory: value: 'Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalContentGraphProjectionFactory' 2: object: 'Doctrine\DBAL\Connection' + +'Neos.ContentRepositoryRegistry:Logger': + className: Psr\Log\LoggerInterface + scope: singleton + factoryObjectName: Neos\Flow\Log\PsrLoggerFactoryInterface + factoryMethodName: get + arguments: + 1: + value: contentRepositoryLogger diff --git a/Neos.ContentRepositoryRegistry/Configuration/Settings.yaml b/Neos.ContentRepositoryRegistry/Configuration/Settings.yaml index d8b23715729..d78307056a8 100644 --- a/Neos.ContentRepositoryRegistry/Configuration/Settings.yaml +++ b/Neos.ContentRepositoryRegistry/Configuration/Settings.yaml @@ -12,6 +12,21 @@ Neos: ignoredClasses: Neos\\ContentRepository\\SharedModel\\NodeType\\NodeTypeManager: true + log: + psr3: + 'Neos\Flow\Log\PsrLoggerFactory': + contentRepositoryLogger: + default: + class: Neos\Flow\Log\Backend\FileBackend + options: + # todo context aware? FLOW_APPLICATION_CONTEXT .. but that contains / + logFileURL: '%FLOW_PATH_DATA%Logs/ContentRepository.log' + createParentDirectories: true + severityThreshold: '%LOG_INFO%' + maximumLogFileSize: 10485760 + logFilesToKeep: 1 + logMessageOrigin: false + ContentRepositoryRegistry: contentRepositories: default: