1
votes

When I switch to "PROD" env (in .env file), and clearing cache, I get this error for the monolog extension:

Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 1 !! !! In FileLoader.php line 168: !!
!! There is no extension able to load the configuration for "monolog" (in /Use !!
rs/antoinenedelec/Documents/symfony/boxbox/config/packages/monolog.yaml). L !! ooked for namespace "monolog", found "framework", "sensio_framework_extra", !! "twig", "security", "fos_user", "doctrine_cache", "doctrine", "doctrine_mi !! grations", "swiftmailer" in /Users/antoinenedelec/Documents/symfony/boxbox/ !! config/packages/monolog.yaml (which is loaded in resource "/Users/antoinene !!
delec/Documents/symfony/boxbox/config/packages/monolog.yaml").
!!
!! !! In YamlFileLoader.php line 657: !!
!! There is no extension able to load the configuration for "monolog" (in /Use !!
rs/antoinenedelec/Documents/symfony/boxbox/config/packages/monolog.yaml). L !! ooked for namespace "monolog", found "framework", "sensio_framework_extra", !! "twig", "security", "fos_user", "doctrine_cache", "doctrine", "doctrine_mi !! grations", "swiftmailer" !! !! !! Script @auto-scripts was called via post-update-cmd antoinenedelec@macbook-pro-de-antoine ~/Documents/symfony/boxbox$

I do have a monolog.yaml in packages and in package/prod. Everything is working great in DEV env.

Using Symfony 4 & PHP 7.1.13

1
Just a guess but check composer.json and verify monolog is under the require section and not the require-dev section.Cerad
it is in the require section, in require-dev i have: "easycorp/easy-log-handler", "symfony/debug-bundle", "symfony/dotenv", "symfony/maker-bundle", "symfony/profiler-pack" and "symfony/var-dumper"Antoine Nedelec
Okay, verify config/bundles.php is loading the monolog bundle in all environments. I have had mysterious issues running S4 under php 7.1 mostly dealing with the environment variables. Moving to 7.2 fixed them. But again these are just guesses. And of course you could try the ever popular removal of the cache directory.Cerad
Oops. Did you do a composer install --no-dev? Because that would skip installing the dotenv component which means your .env will not be used at all. Not sure how that would cause the error message though.Cerad
Haha, the cache "rm -rf *" + "cache:clear" is done before every try ;). Indeed in the bundle.php had no 'prod' => true (also had to tell 'prod' => false for the webprofiler)Antoine Nedelec

1 Answers

1
votes

the problem was in "config/bundles.php"

=> needed to add

  • 'prod' => true

in the corresponding bundle.