magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

Provide full backtrace in exception log #32751

Open onlinebizsoft opened 3 years ago

onlinebizsoft commented 3 years ago

Summary (*)

Since Magento 2.2.x and newer, Magento do not provide a full backtrace for exception. Refer to this ticket https://github.com/magento/magento2/issues/13128

Examples (*)

The issue can be seen whenever an exception happen. I know with xdebug and a test case then developer can get a backtrace on their local environment but in fact, bugs are hard to replicate sometime and when it happens randomly on a production environment, a full backtrace is helpful

Currently all information we get for an exception as below [2018-01-11 09:29:22] main.CRITICAL: Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "1986" already exists. {"exception":"[object] (Exception(code: 0): Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "1986" already exists. at /home/led/domain.com/vendor/magento/framework/Data/Collection.php:404)"} [] [2018-01-11 09:30:27] main.CRITICAL: Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "1986" already exists. {"exception":"[object] (Exception(code: 0): Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "1986" already exists. at /home/led/domain.com/vendor/magento/framework/Data/Collection.php:404)"} [] [2018-01-11 09:42:29] main.CRITICAL: Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "1986" already exists. {"exception":"[object] (Exception(code: 0): Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "1986" already exists. at /home/led/domain.com/vendor/magento/framework/Data/Collection.php:404)"} []

We expected something as below Exception #0 (Exception): Item (Magento/CatalogInventory/Model/Stock/Status/Interceptor) with the same ID "98" already exists.

0 lib/internal/Magento/Framework/Data/AbstractSearchResult.php(233): Magento/Framework/Data/AbstractSearchResult->addItem(Object(Magento/CatalogInventory/Model/Stock/Status/Interceptor))

1 lib/internal/Magento/Framework/Data/AbstractSearchResult.php(102): Magento/Framework/Data/AbstractSearchResult->load()

2 app/code/Magento/CatalogInventoryConfigurableProduct/Plugin/GetInStockAttributeOptionsPlugin.php(62): Magento/Framework/Data/AbstractSearchResult->getItems()

3 lib/internal/Magento/Framework/Interception/Interceptor.php(146): Magento/CatalogInventoryConfigurableProduct/Plugin/GetInStockAttributeOptionsPlugin->afterGetAttributeOptions(Object(Magento/ConfigurableProduct/Model/AttributeOptionProvider/Interceptor), Array, Object(Magento/Catalog/Model/ResourceModel/Eav/Attribute/Interceptor), '128')

.......... ..............)

Proposed solution

The issue were explained and proposed a solution here https://github.com/magento/magento2/issues/13128#issuecomment-816591671

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 3 years ago

Hi @onlinebizsoft. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

onlinebizsoft commented 3 years ago

@MJTheOne @daiduongvo18 @hostep @lbajsarowicz

lbajsarowicz commented 3 years ago

I'm not sure what feedback you expect?

developer can get a backtrace on their local environment

Actually, it's not true, something you've noticed in the logs but you have no idea why this class was called. To investigate the issue, you need information about who called it and how.

onlinebizsoft commented 3 years ago

I'm not sure what feedback you expect?

developer can get a backtrace on their local environment

Actually, it's not true, something you've noticed in the logs but you have no idea why this class was called. To investigate the issue, you need information about who called it and how.

I'm just tagging you here to follow up the new issue :) You know with xdebug and if you can replicate the issue locally then you can have backtrace information.

m2-assistant[bot] commented 3 years ago

Hi @engcom-Echo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

onlinebizsoft commented 3 years ago

@engcom-Echo will this be available for 2.4.3 please? :)

onlinebizsoft commented 3 years ago

Can you take a look at @mrtuvn @ihor-sviziev ?

ihor-sviziev commented 3 years ago

Hi @onlinebizsoft, Could you provide more information on how to reproduce the issue, what is expected, and actual results? Some screenshots or logs would be beneficial.

onlinebizsoft commented 3 years ago

@ihor-sviziev I have edit the description to add more information

ihor-sviziev commented 3 years ago

@sidolov @gabrieldagama @sivaschenko, I think this should be a high priority, as missing the exception stack trace is a terrible thing for debugging issues on production.

PS: we have a custom logger that includes the exception stack trace. That's why I didn't notice it earlier.