magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

exception.log missing

Open siliconalchemy opened this issue 2 years ago • 7 comments

Preconditions and environment

  • Magento version 2.4.5
  • PHP 8.1 (FPM)
  • Apache2.4
  • Ubuntu 20.04

This Magento install has

Steps to reproduce

Trigger an exception/error (for example reCAPTCHA error detailed in #34975), or make generated/ directory read-only to trigger a read-only error.

Expected result

I expect to see an error and trace in var/log/exception.log

Actual result

No exception.log exists. Errors do seem to appear in system.log, but I don't know if they are everything that should be in exception.log.

Additional information

This instance of Magento has been updated since 2.0 to 2.2 and 2.4. In the past exception.log was always present with errors/exceptions.

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [X] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

siliconalchemy avatar Aug 30 '22 16:08 siliconalchemy

Hi @siliconalchemy. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

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

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

: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, join the Community Contributions Triage session to discuss the appropriate ticket.

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

m2-assistant[bot] avatar Aug 30 '22 16:08 m2-assistant[bot]

We have the same issue since 2.4.3-p1 / 2.4.4

amokato avatar Sep 05 '22 11:09 amokato

Same here. 2.4.4 EE. We suspect there is a gap between the preg_match used in module-support and some new log formatting. The matching expressions might need an update to start working correctly again.

adriansanta avatar Sep 05 '22 12:09 adriansanta

We tested that on a vanilla 2.4.4 (Community) in the exception.log is not written there. Would be nice to get some feedback from Magnet here. It's difficult to debug stuff when there is no clue about what happens.

kamephis avatar Sep 08 '22 08:09 kamephis

Any updates on this? Nobody seems to care about such a severe issue.

amokato avatar Sep 23 '22 07:09 amokato

@sdzhepa: can we have somebody to verify this? This indeed sounds like a P0 or P1 prio if it's true. Thanks!

I can not confirm that this is true on Magento 2.4.3-p3 on production shops of ours, it works as expected over there. We haven't tried 2.4.4 or 2.4.5 yet in production, so I can't speak about those versions yet.

hostep avatar Sep 23 '22 11:09 hostep

We're having this issue on 2.4.4 (CE). It seems that some errors are written to the system.log.

amokato avatar Sep 23 '22 12:09 amokato

In our case the exceptions seem to be written into the system.log instead of the exception.log (2.4.4 CE). The exception.log stays empty.

kamephis avatar Sep 28 '22 16:09 kamephis

Hi @engcom-November. 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:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Sep 30 '22 09:09 m2-assistant[bot]

Verified the issue on fresh instance of 2.4.5 Project-community-edition and the issue is reproducible. exception.log file is missing in var/log folder. No errors are written into exception.log. Only all errors are written into system.log file. Note: There is no issue when the Magento is upgraded to 2.4.5 from 2.4.3 Project-community-edition. exception.log file is present in this case and all the errors/exceptions are getting written into exception.log file as expected. Hence confirming this issue.

engcom-November avatar Sep 30 '22 09:09 engcom-November

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-6796 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Sep 30 '22 09:09 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Sep 30 '22 09:09 m2-assistant[bot]

Hi @siliconalchemy , Reviewed the issue again and after internal discussion, it has been concluded that this is not an issue. Magento has changed the way to write into exception.log File. To print the log in exception.log, exception parameters must be given in context.

  1. $this->logger->critical($e, ['exception' => $e]);
  2. $this->logger->log('CRITICAL', $e->getMessage(), ['exception' => $e]); Kindly recheck and let us know if you are still facing any issues. Thank you.

engcom-November avatar Oct 21 '22 04:10 engcom-November

@engcom-November - Ah! Haha that's a really funny april fools joke!!

Oh wait, it's the middle of October, it's not April 1st.

** THIS IS A BUG ** var/log/exception.log is a well established log for critical errors. This is not about custom code/modules, user logging. This is fundamental, built in logging from standard usage of Magento. References to it are littered throughout the official Magento documentation. Have a look.
** THIS IS A BUG **

eg. https://devdocs.magento.com/cloud/project/log-locations.html Exception log: var/log/exception.log

https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/cli/configure-cron-jobs.html Jobs with an ERROR status are always logged as CRITICAL in <install_directory>/var/log/exception.log.

etc etc

siliconalchemy avatar Oct 21 '22 10:10 siliconalchemy

100% agree with @siliconalchemy

Having all kind of log severities in the same file (system.log) really makes it difficult to use and defeats the purpose of log severity in the first place. We have to employ various workarounds (like parsing rules) to filter out "noise" lines in order to have a realistic overview of actual issues.

Furthermore, exception.log is not populated not only by custom/third party code, but also by Magento core code itself.

At least we could expect from core team to list this so-called "feature" in their release notes, as a backwards incompatible change. But ideally, this should be fixed to work as in the previous versions.

adriansanta avatar Oct 21 '22 10:10 adriansanta

I agree, this is by far not a feature. Please take your time and fix this. It has been month and nothing happened.

kamephis avatar Oct 21 '22 13:10 kamephis

Yes, we are also experiencing this same issue. So does 2.4.5 upgrade fix this?

jurvi avatar Oct 24 '22 07:10 jurvi

This needs to be fixed asap. do you know how many sites are trying to get updated to 2.4.4 or 2.4.5 by 11/28? Lots... They all need that exception.log to be working like it is stated to work and how it has always worked.

briangmoore77 avatar Oct 24 '22 14:10 briangmoore77

Hello @siliconalchemy @adriansanta @kamephis @jurvi @briangmoore77, We have discussed this issue again internally and after further analysis came across the below commit: https://github.com/magento/magento2/commit/8e6aedc8130be01669b04f99c19ab3f48e4c0691 We are confirming this issue and further analysis is in progress. Thank you.

engcom-November avatar Oct 25 '22 09:10 engcom-November

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-6796

github-jira-sync-bot avatar Oct 25 '22 09:10 github-jira-sync-bot

Hello @engcom-November - We are facing same issue. Do we have any temp solution to enable exception.log, As lots of client facing issues.

MeetKamal avatar Oct 27 '22 06:10 MeetKamal

I would be also interested in a temp solution if such exists, two clients are now missing exception.log making problem debugging unnecessarily harder.

jurvi avatar Oct 28 '22 13:10 jurvi

@MeetKamal

We have verified this issue in our local environment and found work around(temporary) solution for it.

File path where need to replace core code: vendor/magento/framework/Logger/Handler/System.php

Please replace below code:

public function write(array $record): void
    {
        if (isset($record['context']['exception'])) {
            $this->exceptionHandler->handle($record);

            return;
        }
        $record['formatted'] = $this->getFormatter()->format($record);

        parent::write($record);
    }

With :

public function write(array $record): void
    {
        	
        if (isset($record['context']['exception']) || $record['level'] == Logger::CRITICAL) {
            $this->exceptionHandler->handle($record);

            return;
        }
        $record['formatted'] = $this->getFormatter()->format($record);

        parent::write($record);
    }

Shaikh-Samir avatar Oct 31 '22 09:10 Shaikh-Samir

Hi @Shaikh-Samir - Thank you for the Work around, Have tested and it seems working :)

MeetKamal avatar Oct 31 '22 14:10 MeetKamal

Is this going backwards? I figured this would be fixed by now.

briangmoore77 avatar Nov 18 '22 22:11 briangmoore77

Still no exception.log in M2.4.5-p1

PaperDS avatar Nov 23 '22 09:11 PaperDS

Still no exception.log in M2.4.5-p1

Hello @PaperDS We have tested this work around solution in M2.4.5-p1 as well and its working correctly in our project.

Thank you.

Shaikh-Samir avatar Nov 23 '22 10:11 Shaikh-Samir

@

Still no exception.log in M2.4.5-p1

Hello @PaperDS We have tested this work around solution in M2.4.5-p1 as well and its working correctly in our project.

Thank you.

I've applied your work around and it works perfectly. Many thanks. I just don't like editing core code :-)

PaperDS avatar Nov 23 '22 18:11 PaperDS

This might be fixed under ACP2E-1287: log exception to exception.log (untested), unfortunately no clean merge commit, so you'll probably want to add those 4 separate commits together in a patch.

hostep avatar Nov 23 '22 20:11 hostep

@

Still no exception.log in M2.4.5-p1

Hello @PaperDS We have tested this work around solution in M2.4.5-p1 as well and its working correctly in our project. Thank you.

I've applied your work around and it works perfectly. Many thanks. I just don't like editing core code :-)

@PaperDS Yes got your point, its not best practice to edit in core code of framework, actually i also don't like to do this. So that mentioned it work around fix (as temporary solution). And if don't want to change in core magneto files then you can also create one patch for those changes and install.

Shaikh-Samir avatar Nov 24 '22 07:11 Shaikh-Samir