Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fix for OXID 6.2 circular reference service problems
# thx to alfred ( for sharing
# add to modules/functions.php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
function getLogger() {
$loggerServiceName = LoggerInterface::class;
try {
$container = ContainerFactory::getInstance()->getContainer();
return $container->get($loggerServiceName);
} catch (ServiceCircularReferenceException $exception) {
if (strpos($exception->getMessage(), $loggerServiceName) !== false) {
$logger = new Logger('OXID Logger');
$logger->pushHandler(new StreamHandler(OX_LOG_FILE, Logger::ERROR));
$logger->critical('Not able to load logger from container');
return $logger;
throw $exception;
Copy link

suabo commented Oct 14, 2020

Thx 4 Sharing

Copy link

@proudcommerce & @suabo FYI: There is also an open Pull-Request to fix this directly in the core: OXID-eSales/oxideshop_ce#810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment