Conflict Monolog 3.8.x psr with psr\log 1.0

I installed acorn 4.x that is using Monolog ver 3.8.x that supports psr\log 2.0 and 3.0 but not 1.0.
I am using the cloudflare plugin that uses psr\log 1.0 that then conflicts with the monolog psr that cannot be downgraded to 1.0.

How can I solve this issue ?

Is it a known conflict with no fix possible on our end. Check out Compatibility | Acorn Docs | Roots and the related PR linked from that page.

Thanks for the quick response.

I just jumped down the rabbit hole of trying to fix this, but even with the pull request it didn’t work for Acorn 5 when running wp acorn optimize. Instead of starting my own thread, I figured I’d post it here instead because this is where you end up if you search for the issue on Google.

Here’s what you need to do if you want to fix it.

Option 1 - Do it yourself

  • Download the stuff from the PR, one way or another.

  • Open cloudflare/src/Integration/DefaultLogger.php

  • Add a \ in front of the two Stringable functions like this:
    public function log($level, \Stringable|string $message, array $context = []): void
    public function debug(\Stringable|string $message, array $context = []): void

  • Open cloudflare/composer.json

  • Set require to this:

"require": {
        "php": ">=8.1",
        "cloudflare/cf-ip-rewrite": "^1.0.0",
        "symfony/polyfill-intl-idn": "*",
        "psr/log": "^3.0"
    },
  • Open the Cloudflare folder’s .gitignore and add a # before vendor/

Now hammer this into your terminal:
trellis vm shell

cd web/app/plugins/cloudflare && composer update

Tada, it now works!

Option 2 - Use my GitHub repo AKA just trust me bro
Download this and install it as you would any non-composer plugin:

Have fun!

That is all. Thanks for coming to my TED talk.