# [SOLVED] Acorn v3 -> v4 Upgrade | PSR Logger Issue -> Bedrock/WPML | Fatal error: Declaration of Monolog\Logger::emergency

**URL:** https://discourse.roots.io/t/solved-acorn-v3-v4-upgrade-psr-logger-issue-bedrock-wpml-fatal-error-declaration-of-monolog-logger-emergency/26987
**Category:** acorn
**Created:** 2024-04-15T09:16:57Z
**Posts:** 13
**Showing post:** 7 of 13

## Post 7 by @RistoKaalma — 2024-04-16T07:52:08Z

Perhaps you don’t need to start a duplicate support thread on WPML - fellow [Roots.io](http://Roots.io) members are on it already:

1. [Fatal error: Declaration of Monolog - WPML](https://wpml.org/forums/topic/fatal-error-declaration-of-monolog/)
2. [https://github.com/mollie/WooCommerce/issues/892](https://github.com/mollie/WooCommerce/issues/892)

When using Bedrock for managing plugins with composer, [composer-patches](https://github.com/cweagans/composer-patches) (shout-out to @tombro for the suggestion) might be useful until WPML v4.7 is released.

In Bedrock dir:

1. Run `composer require cweagans/composer-patches`
2. Add to `"config"` → `"allow-plugins"` in in composer.json:

```
[...],
"cweagans/composer-patches": true
```

1. Add to `"extra"` in composer.json:

```
[...],
"patches": {
      "wpml/wpml-multilingual-cms": {
        "Fix monolog": "patches/wpml-multilingual-cms/monolog-fix.patch"
      }
    }
```

1. Write to `patches/wpml-multilingual-cms/monolog-fix.patch` file:

```
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -62,10 +62,10 @@
         array (
             0 => __DIR__. '/..' . '/symfony/polyfill-ctype',
         ),
- 'Psr\\Log\\' => 
- array (
- 0 => __DIR__. '/..' . '/psr/log/Psr/Log',
- ),
+ // 'Psr\\Log\\' => 
+ // array (
+ // 0 => __DIR__. '/..' . '/psr/log/Psr/Log',
+ // ),
         'PhpMyAdmin\\SqlParser\\' => 
         array (
             0 => __DIR__. '/..' . '/wpml/sql-parser/src',
```

1. Manually delete `web/app/plugins/wpml-multilingual-cms` dir

For me, seemingly it only ran when a plugin is being initially installed (or maybe updated… ultimately the state needs to “change” for it to work) - thus I had to manually delete the existing plugin files.

1. Run `composer update` - my output:

```
xxx@yyy:~/Projects/example-web/site$ composer update
Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies                                 
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing wpml/wpml-multilingual-cms (4.6.9): Extracting archive
  - Applying patches for wpml/wpml-multilingual-cms
    patches/wpml-multilingual-cms/monolog-fix.patch (Fix monolog)

Generating optimized autoload files
> Roots\Acorn\ComposerScripts::postAutoloadDump
68 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
```

---

_[View the full topic](https://discourse.roots.io/t/solved-acorn-v3-v4-upgrade-psr-logger-issue-bedrock-wpml-fatal-error-declaration-of-monolog-logger-emergency/26987)._
