Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monolog issue #35604

Closed
1 of 5 tasks
Nuranto opened this issue Jun 10, 2022 · 23 comments
Closed
1 of 5 tasks

Monolog issue #35604

Nuranto opened this issue Jun 10, 2022 · 23 comments
Labels
Area: Upgrades - Upgrade Compatibility Tool Component: Framework/Code Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@Nuranto
Copy link
Contributor

Nuranto commented Jun 10, 2022

Preconditions and environment

  • Magento version 2.4.4
  • PHP8.1
  • Install data-migration-tool
  • Monolog 2.7.0

Steps to reproduce

  1. composer update
  2. bin/magento setup:upgrade

Expected result

Everything works fine

Actual result

PHP Fatal error:  Declaration of Migration\Logger\Logger::addRecord(int $level, string $message, array $context = []): bool must be compatible with Monolog\Logger::addRecord(int $level, string $message, array $context = [], ?Monolog\DateTimeImmutable $datetime = null): bool in /var/www/html/vendor/magento/data-migration-tool/src/Migration/Logger/Logger.php on line 34

Additional information

Monolog 2.7.0 has bee released yesterday, and have breaking changes.

Quick Solution : fix dependency to 2.6.0
Best Solution : fix compatibility issues

Note that everyone who upgrades to 2.4.4 from now will probably have this issue.

Quick solution for devs who don't want to wait for a fix & release : composer require monolog/monolog:2.6.0

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.
  • 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”.
@m2-assistant
Copy link

m2-assistant bot commented Jun 10, 2022

Hi @Nuranto. 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.


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

🕙 You can find the schedule on the Magento Community Calendar page.

📞 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.

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

@mrtuvn
Copy link
Contributor

mrtuvn commented Jun 10, 2022

i think we should report here
https://github.com/magento/data-migration-tool/issues

@convenient
Copy link
Contributor

convenient commented Jun 10, 2022

Similar to this #35596 which affects integration tests

@m2-assistant
Copy link

m2-assistant bot commented Jun 15, 2022

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: 👇

  • 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.

@engcom-November
Copy link
Contributor

Hi @Nuranto ,
Thank you for reporting and collaboration. Verified the issue by upgrading from 2.4.3-p1 to 2.4.4 but could not able to reproduce the issue.
Steps performed:

  1. Installed 2.4.3-p1 project-community-edition with PHP7.4
  2. Upgraded to 2.4.4 project-community-edition (Ref upgrade guide:
  3. Ran composer update
  4. Ran: php bin/magento setup:upgrade - No issue
  5. Upgraded php to 8.1
    No issue: Upgrade successful. User is able to access Magento admin and UI.
    Kindly elaborate the steps/ missing configuration details to reproduce the issue. Thank you.

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label Jun 16, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jun 16, 2022
@engcom-November engcom-November added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Jun 16, 2022
@mrtuvn
Copy link
Contributor

mrtuvn commented Jun 16, 2022

you need install monolog v2.7.0 to able see problem

@engcom-November
Copy link
Contributor

Thanks for the update @mrtuvn
However, monolog is not part of https://github.com/magento/magento2 git repository. Community cannot able to provide fix for it in this repository.
As per Magento devdocs, Magento uses Monolog by default. Monolog implemented as a preference for Psr\Log\LoggerInterface in the Magento application di.xml Kindly refer this guide to use the same for logging. Otherwise all questions, issue reports and fix for them should be addressed to the corresponding extension owners(support)
Thank you.

@convenient
Copy link
Contributor

convenient commented Jun 17, 2022

@engcom-November

The facts

  • Magento require version ^2.6 of monolog, which means that 2.7.0 is the highest version that is installed when you composer create project of magento
    "monolog/monolog": "^2.6",
  • This means magento either needs to say <=2.7.0 for their monolog requirement, or fix their application code to be compatible.

Either way there is an action for magento here, when you build a version of latest magento from scratch you will pull in a monolog version incompatible with some magento code.

The maintainer of monolog thinks the implementations by magento in the data migration tool and the integration test infrastructure is, and i quote, "madness".

See Seldaek/monolog#1684 (comment) and also see #35596 (comment) where this issue affects the ability to run tests, the thing that ensures we are able to deliver robust software.

@engcom-November
Copy link
Contributor

Verified the issue again by installing Magento 2.4.4 project-community-edition with PHP 8.1 but could not able to reproduce the issue with below steps performed:

  1. Installed Magento 2.4.4 Project Community edition with PHP 8.1.6
  2. Ran > composer require monolog/monolog:2.7.0 . (composer.json file got updated with "monolog/monolog": "2.7.0")
  3. Ran > composer update
  4. Ran > php bin/magento setup:upgrade
    No issue: Upgrade is successful.
    Kindly provide missing steps / configuration details to reproduce the issue.
    Thank you.

@convenient
Copy link
Contributor

@engcom-November this issue i think you may also need to install https://github.com/magento/data-migration-tool#install-the-data-migration-tool

For my PR (#35596) to replicate you would need to run the integration tests but best to keep separate as they'd be separate codefixes :)

@engcom-November
Copy link
Contributor

Verified the issue again on Magento 2.4.4 Project community edition with PHP 8.1.6 and the issue is reproducible on installing data-migration-tool.
Error:
PHP Fatal error: Declaration of Migration\Logger\Logger::addRecord(int $level, string $message, array $context = []): bool must be compatible with Monolog\Logger::addRecord(int $level, string $message, array $context = [], ?Monolog\DateTimeImmutable $datetime = null): bool in /var/www/html/mg244/project-community-edition/vendor/magento/data-migration-tool/src/Migration/Logger/Logger.php on line 34

@engcom-November engcom-November added Component: Framework/Code Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Upgrades - Upgrade Compatibility Tool Reported on 2.4.4 Indicates original Magento version for the Issue report. labels Jun 20, 2022
@m2-community-project m2-community-project bot removed the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Jun 20, 2022
@engcom-November engcom-November added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch labels Jun 20, 2022
@m2-community-project m2-community-project bot moved this from Needs Update to Confirmed in Issue Confirmation and Triage Board Jun 20, 2022
@m2-community-project m2-community-project bot removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: needs update Additional information is require, waiting for response labels Jun 20, 2022
@engcom-Alfa engcom-Alfa linked a pull request Jun 21, 2022 that will close this issue
5 tasks
@engcom-November engcom-November added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Upgrades - Upgrade Compatibility Tool labels Jul 15, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-5973 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Jul 15, 2022

✅ 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.

@timoffmax
Copy link

Also reproducible when you run integration tests.

@convenient
Copy link
Contributor

Seldaek/monolog@3cba75e

Mark Logger https://github.com/Final to discourage extension

Updating to use a handler seems like the right thing to do.

@damienwebdev
Copy link
Member

Just a notification that a further update to Monolog versions occurred ~3 hours ago - 2.8.0 https://github.com/Seldaek/monolog/releases/tag/2.8.0.

I had code like:

composer require monolog/monolog:"!=2.7.0" --no-update

Which I now changed to:

composer require monolog/monolog:"<2.7.0" --no-update

@ihor-sviziev
Copy link
Contributor

Looks like in Magento 2.4.5 we have a fix for this issue 360fd1b

@hostep
Copy link
Contributor

hostep commented Aug 11, 2022

The full AC-3556 fix is here: b2bfd05

Unfortunately the fix seems just like a workaround, because this problem might happen again in the future.
It's probably wiser if Adobe listens to the recommendations of the author of the monolog library who suggests a more future proofed way to fix this.

@convenient
Copy link
Contributor

Agreed @hostep

I did try and have some conversation about this back in June but was ignored.

#35596 (comment)

My workaround was then taken in any case 🙃

@Nuranto
Copy link
Contributor Author

Nuranto commented Aug 29, 2022

Hi there,

I think you missed this one : vendor/magento/data-migration-tool/src/Migration/Logger/Logger.php

@engcom-Hotel
Copy link
Contributor

Hello,

As I can see this issue got fixed by the internal team
Related commits: b2bfd05

Hence closing the issue.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Upgrades - Upgrade Compatibility Tool Component: Framework/Code Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.