4000-520-616
欢迎来到免疫在线!(蚂蚁淘生物旗下平台)  请登录 |  免费注册 |  询价篮
主营:原厂直采,平行进口,授权代理(蚂蚁淘为您服务)
咨询热线电话
4000-520-616
当前位置: 首页 > 新闻动态 >
热卖商品
新闻详情
Catch circular reference for logger in getLogger()-开源项目...
来自 : CSDN技术社区 发布时间:2021-03-26

私信 访问主页

\"weixin_39988331\" weixin_39988331 2020-12-09 07:38 首页 开源项目 Catch circular reference for logger in getLogger()

We saw this error in the oxideshop.log:

OXID Logger.ERROR: Circular reference detected for service Psr\\Log\\LoggerInterface , path: Psr\\Log\\LoggerInterface - Psr\\Log\\LoggerInterface . [ [object] (Symfony\\\\Component\\\\DependencyInjection\\\\Exception\\\\ServiceCircularReferenceException(code: 0)

We had this once in a project and three other devs from other projects had the same error.

see also: https://gist.github.com/proudcommerce/602ab33c23a1546588266812ed72ac30

Unfortunately, I have no steps to reproduce again

I m glad if someone finds a better solution to this, just wanted to dump this out here, since that s a better place than a random gist.

该提问来源于开源项目 OXID-eSales/oxideshop_ce

点赞 写回答 收藏 复制链接分享 邀请回答 删除 再等等 结题 再想想 7条回答

私信 访问主页

\"weixin_40000131\" weixin_40000131 3月前

Another workaround could be to let onModuleExtensionCreationError() only remember the broken $moduleClass in some array and to do the actual error-handling/logging outside onModuleExtensionCreationError() later (for example in the php shutdown-handler).If the logging is not done inside onModuleExtensionCreationError() i think an endless loop/recursion would not happen (which currently triggers the Circular-Reference-Exception)

For testing the error can be forced by adding a non-existing class in oxconfig.aModules as class-extension for Oxid s Language -class (or any other class that Config- init() directly or indirectly uses using oxNew())Just doing nothing but a return; in onModuleExtensionCreationError() lets oxid load without any issues in most of these cases and in the backend Installed Shop Modules then suggests to remove the broken module data...

点赞 评论 复制链接分享

私信 访问主页

\"weixin_39988331\" weixin_39988331 3月前

I think was talking about something like https://github.com/OXID-eSales/docker-eshop-sdk where I can reproduce the issue.

点赞 评论 复制链接分享

私信 访问主页

\"weixin_39598568\" weixin_39598568 3月前

there is no such thing as a clean project. That is why the shop must be resilient to certain kinds of errors and should be prepared for them. Especially everything from the modules or the configurations can t be trusted entirely.

点赞 评论 复制链接分享

私信 访问主页

\"weixin_39988331\" weixin_39988331 3月前

Hi , I don t have a clean project at the moment, but I guess it should be reproducible by installing a module on a feature branch and then switching to the master branch again, that s how I can reproduce this in my project.

点赞 评论 复制链接分享

私信 访问主页

\"weixin_39846089\" weixin_39846089 3月前

thanks for pointing it out here, looks like you have module class extension data in the database for a no longer existent class, a better solution could be find and fix the circular reference if it s possible, if it s not possible - use another logger in the autoloader (ModuleChainsGenerator class), not a service from the container. Is it reproducible with any module on a clean project?

点赞 评论 复制链接分享

私信 访问主页

\"weixin_39988331\" weixin_39988331 3月前

I got the same error just now again, I have more details now.

We re using the Metapackage Version 6.2.2. I was working on a feature branch where we added a new module. After switching to the master branch, I can barely do anything, because this error appears even if I try to run vendor/bin/oe-console oe:module:apply-configuration.

Here s the full error:

[06 Oct 13:12:37.110807 2020] [uncaught error] [type E_ERROR] [file /var/www/oxideshop/vendor/symfony/dependency-injection/Container.php] [line 297] [code ] [message Uncaught Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException: Circular reference detected for service Psr\\Log\\LoggerInterface , path: Psr\\Log\\LoggerInterface - Psr\\Log\\LoggerInterface . in /var/www/oxideshop/vendor/symfony/dependency-injection/Container.php:297Stack trace:#0 /var/www/oxideshop/source/overridablefunctions.php(209): Symfony\\Component\\DependencyInjection\\Container- get( Psr\\\\Log\\\\LoggerI... )#1 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Registry.php(329): getLogger()#2 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php(420): OxidEsales\\EshopCommunity\\Core\\Registry::getLogger()#3 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php(300): OxidEsales\\EshopCommunity\\Core\\Module\\ModuleChainsGenerator- onModuleExtensionCreationError( norisk\\\\nrClickA... )#4 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php(251):]

After applying this patch and running the command again I see this in the log:

[2020-10-06 13:28:43] OXID Logger.CRITICAL: Not able to load logger from container [] [][2020-10-06 13:28:43] OXID Logger.ERROR: Module class norisk\\nrClickAndCollect\\Extensions\\Core\\nrcnc_Session not found. Module ID (module id not availible) [ [object] (OxidEsales\\\\Eshop\\\\Core\\\\Exception\\\\SystemComponentException(code: 0): Module class norisk\\\\nrClickAndCollect\\\\Extensions\\\\Core\\\\nrcnc_Session not found. Module ID (module id not availible) at /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php:419) ] [][2020-10-06 13:28:43] OXID Logger.ERROR: Module class norisk\\nrClickAndCollect\\Extensions\\Core\\nrcnc_Session not found. Module ID (module id not availible) [ [object] (OxidEsales\\\\Eshop\\\\Core\\\\Exception\\\\SystemComponentException(code: 0): Module class norisk\\\\nrClickAndCollect\\\\Extensions\\\\Core\\\\nrcnc_Session not found. Module ID (module id not availible) at /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php:419)\\n[stacktrace]\\n#0 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php(300): OxidEsales\\\\EshopCommunity\\\\Core\\\\Module\\\\ModuleChainsGenerator- onModuleExtensionCreationError( norisk\\\\\\\\nrClickA... )\\n#1 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php(251): OxidEsales\\\\EshopCommunity\\\\Core\\\\Module\\\\ModuleChainsGenerator- createClassExtension( oxsession , norisk\\\\\\\\nrClickA... )\\n#2 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleChainsGenerator.php(56): OxidEsales\\\\EshopCommunity\\\\Core\\\\Module\\\\ModuleChainsGenerator- createClassExtensions(Array, oxsession )\\n#3 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/UtilsObject.php(270): OxidEsales\\\\EshopCommunity\\\\Core\\\\Module\\\\ModuleChainsGenerator- createClassChain( OxidEsales\\\\\\\\Esho... , oxsession )\\n#4 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/UtilsObject.php(220): OxidEsales\\\\EshopCommunity\\\\Core\\\\UtilsObject- getClassName( oxsession )\\n#5 /var/www/oxideshop/source/oxfunctions.php(104): OxidEsales\\\\EshopCommunity\\\\Core\\\\UtilsObject- oxNew( OxidEsales\\\\\\\\Esho... )\\n#6 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Registry.php(409): oxNew( OxidEsales\\\\\\\\Esho... )\\n#7 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Registry.php(429): OxidEsales\\\\EshopCommunity\\\\Core\\\\Registry::createObject( OxidEsales\\\\\\\\Esho... )\\n#8 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Registry.php(101): OxidEsales\\\\EshopCommunity\\\\Core\\\\Registry::getObject( OxidEsales\\\\\\\\Esho... )\\n#9 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ee/Core/Config.php(110): OxidEsales\\\\EshopCommunity\\\\Core\\\\Registry::getSession()\\n#10 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ee/Core/Config.php(65): OxidEsales\\\\EshopEnterprise\\\\Core\\\\Config- _getShopIdFromSession()\\n#11 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Config.php(814): OxidEsales\\\\EshopEnterprise\\\\Core\\\\Config- calculateActiveShopId()\\n#12 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Model/BaseModel.php(585): OxidEsales\\\\EshopCommunity\\\\Core\\\\Config- getShopId()\\n#13 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Model/BaseModel.php(214): OxidEsales\\\\EshopCommunity\\\\Core\\\\Model\\\\BaseModel- getViewName()\\n#14 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/Model/MultiLanguageModel.php(44): OxidEsales\\\\EshopCommunity\\\\Core\\\\Model\\\\BaseModel- __construct()\\n#15 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Application/Model/Shop.php(94): OxidEsales\\\\EshopCommunity\\\\Core\\\\Model\\\\MultiLanguageModel- __construct()\\n#16 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/source/Core/UtilsObject.php(232): OxidEsales\\\\EshopCommunity\\\\Application\\\\Model\\\\Shop- __construct()\\n#17 /var/www/oxideshop/source/oxfunctions.php(104): OxidEsales\\\\EshopCommunity\\\\Core\\\\UtilsObject- oxNew( OxidEsales\\\\\\\\Esho... )\\n#18 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ee/Internal/Transition/Adapter/EnterpriseShopAdapter.php(22): oxNew( OxidEsales\\\\\\\\Esho... )\\n#19 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ee/Internal/Framework/Console/Executor.php(74): OxidEsales\\\\EshopEnterprise\\\\Internal\\\\Transition\\\\Adapter\\\\EnterpriseShopAdapter- validateShopId(1)\\n#20 /var/www/oxideshop/vendor/oxid-esales/oxideshop-ce/bin/oe-console(43): OxidEsales\\\\EshopEnterprise\\\\Internal\\\\Framework\\\\Console\\\\Executor- execute()\\n#21 {main}\\n ] []

本文链接: http://420vendorshop.immuno-online.com/view-785005.html

发布于 : 2021-03-26 阅读(0)
公司介绍
品牌分类
联络我们
服务热线:4000-520-616
(限工作日9:00-18:00)
QQ :1570468124
手机:18915418616
官网:http://