[GH-ISSUE #188] Unable to install 'mlehner/gelf-php' running 'composer.phar update' in Symfony 2.1 #63

Closed
opened 2026-03-04 02:11:48 +03:00 by kerem · 9 comments
Owner

Originally created by @svscorp on GitHub (May 2, 2013).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/188

Hello.

I'm trying to enable GELF logging in my Symfony 2.1 project.

Enabling this handler in config.yml I started to have this error:

Fatal error: Class 'Gelf\MessagePublisher' not found in ...project/app/cache/dev/appDevDebugProjectContainer.php on line 1232

Call Stack:
    0.0002     650352   1. {main}() ...project/web/app_dev.php:0
    0.0112    2831112   2. Symfony\Component\HttpKernel\Kernel->handle() ...project/web/app_dev.php:31
    0.0112    2831272   3. Symfony\Component\HttpKernel\Kernel->boot() ...project/app/bootstrap.php.cache:614
    0.0162    3197272   4. Symfony\Component\HttpKernel\Kernel->initializeContainer() ...project/app/bootstrap.php.cache:571
    1.5372   38897968   5. Symfony\Component\DependencyInjection\Container->get() ...project/app/bootstrap.php.cache:871
    1.5372   38898872   6. appDevDebugProjectContainer->getCacheWarmerService() ...project/app/bootstrap.php.cache:211
    1.5378   38946112   7. Symfony\Component\DependencyInjection\Container->get() ...project/app/cache/dev/appDevDebugProjectContainer.php:188
    1.5378   38946688   8. appDevDebugProjectContainer->getRouterService() ...project/app/bootstrap.php.cache:211
    1.5379   38955368   9. Symfony\Component\DependencyInjection\Container->get() ...project/app/cache/dev/appDevDebugProjectContainer.php:1501
    1.5379   38955984  10. appDevDebugProjectContainer->getMonolog_Logger_RouterService() ...project/app/bootstrap.php.cache:211
    1.5380   38958760  11. Symfony\Component\DependencyInjection\Container->get() ...project/app/cache/dev/appDevDebugProjectContainer.php:1360
    1.5381   38959376  12. appDevDebugProjectContainer->getMonolog_Handler_GelfService() ...project/app/bootstrap.php.cache:211

Okay, probably I need to do:

php composer.phar update --dev

... using '--dev' to install mlehner/gelf-php dependency of monolog stored in 'required-dev' option of monolog composer.json

After execution this command I got:

  svscorp@vm:~/project$ php composer.phar update monolog/monolog --dev
  Warning: This development build of composer is over 30 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version.
Loading composer repositories with package information
Updating dependencies
  - Removing monolog/monolog (1.2.1)
  - Installing monolog/monolog (1.5.0)
    Downloading: 100%         
    Unpacking archive
    Cleaning up

monolog/monolog suggests installing mlehner/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))

Loading composer repositories with package information
Updating dev dependencies
Nothing to install or update
Writing lock file
Generating autoload files
Clearing the cache for the dev environment with debug true
Installing assets using the symlink option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for Symfony\Bundle\WebProfilerBundle into web/bundles/webprofiler
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution

I tried to remove all vendors and run composer install. No result. Couldn't found any info about this issue.

So how to install monolog with this gelf-php? Even if I move this bundle to the 'require' option (instead of 'require-dev') - no result.

Originally created by @svscorp on GitHub (May 2, 2013). Original GitHub issue: https://github.com/Seldaek/monolog/issues/188 Hello. I'm trying to enable GELF logging in my Symfony 2.1 project. Enabling this handler in config.yml I started to have this error: ``` php Fatal error: Class 'Gelf\MessagePublisher' not found in ...project/app/cache/dev/appDevDebugProjectContainer.php on line 1232 Call Stack: 0.0002 650352 1. {main}() ...project/web/app_dev.php:0 0.0112 2831112 2. Symfony\Component\HttpKernel\Kernel->handle() ...project/web/app_dev.php:31 0.0112 2831272 3. Symfony\Component\HttpKernel\Kernel->boot() ...project/app/bootstrap.php.cache:614 0.0162 3197272 4. Symfony\Component\HttpKernel\Kernel->initializeContainer() ...project/app/bootstrap.php.cache:571 1.5372 38897968 5. Symfony\Component\DependencyInjection\Container->get() ...project/app/bootstrap.php.cache:871 1.5372 38898872 6. appDevDebugProjectContainer->getCacheWarmerService() ...project/app/bootstrap.php.cache:211 1.5378 38946112 7. Symfony\Component\DependencyInjection\Container->get() ...project/app/cache/dev/appDevDebugProjectContainer.php:188 1.5378 38946688 8. appDevDebugProjectContainer->getRouterService() ...project/app/bootstrap.php.cache:211 1.5379 38955368 9. Symfony\Component\DependencyInjection\Container->get() ...project/app/cache/dev/appDevDebugProjectContainer.php:1501 1.5379 38955984 10. appDevDebugProjectContainer->getMonolog_Logger_RouterService() ...project/app/bootstrap.php.cache:211 1.5380 38958760 11. Symfony\Component\DependencyInjection\Container->get() ...project/app/cache/dev/appDevDebugProjectContainer.php:1360 1.5381 38959376 12. appDevDebugProjectContainer->getMonolog_Handler_GelfService() ...project/app/bootstrap.php.cache:211 ``` Okay, probably I need to do: ``` php php composer.phar update --dev ``` ... using '--dev' to install mlehner/gelf-php dependency of monolog stored in 'required-dev' option of monolog composer.json After execution this command I got: ``` bash svscorp@vm:~/project$ php composer.phar update monolog/monolog --dev Warning: This development build of composer is over 30 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version. Loading composer repositories with package information Updating dependencies - Removing monolog/monolog (1.2.1) - Installing monolog/monolog (1.5.0) Downloading: 100% Unpacking archive Cleaning up monolog/monolog suggests installing mlehner/gelf-php (Allow sending log messages to a GrayLog2 server) monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server) monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required)) Loading composer repositories with package information Updating dev dependencies Nothing to install or update Writing lock file Generating autoload files Clearing the cache for the dev environment with debug true Installing assets using the symlink option Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework Installing assets for Symfony\Bundle\WebProfilerBundle into web/bundles/webprofiler Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution ``` I tried to remove all vendors and run composer install. No result. Couldn't found any info about this issue. So how to install monolog with this gelf-php? Even if I move this bundle to the 'require' option (instead of 'require-dev') - no result.
kerem closed this issue 2026-03-04 02:11:48 +03:00
Author
Owner

@svscorp commented on GitHub (May 2, 2013):

Even with command:

php composer.phar update mlehner/gelf-php -d vendor/monolog/monolog/

I've got the same exception. So what is wrong?

<!-- gh-comment-id:17334475 --> @svscorp commented on GitHub (May 2, 2013): Even with command: ``` bash php composer.phar update mlehner/gelf-php -d vendor/monolog/monolog/ ``` I've got the same exception. So what is wrong?
Author
Owner

@stof commented on GitHub (May 2, 2013):

Why -d vendor/monolog/monolog ? Composer installs all dependencies of your project in the same vendor dir, not in nested vendor dirs.

And to be able to use this handler, you have to add a requirement on mlehner/gelf-php in your composer.json. Monolog itself does not require it as it is only an optional dependency (it is needed only when using the GelfHandler), which is why it appears only as a suggestion

<!-- gh-comment-id:17335050 --> @stof commented on GitHub (May 2, 2013): Why `-d vendor/monolog/monolog` ? Composer installs all dependencies of your project in the same vendor dir, not in nested vendor dirs. And to be able to use this handler, you have to add a requirement on `mlehner/gelf-php` in your composer.json. Monolog itself does not require it as it is only an optional dependency (it is needed only when using the GelfHandler), which is why it appears only as a suggestion
Author
Owner

@pborreli commented on GitHub (May 2, 2013):

it may not fix your problem but you should update (selfupdate) your composer before creation of any issue

<!-- gh-comment-id:17335410 --> @pborreli commented on GitHub (May 2, 2013): it may not fix your problem but you should update (selfupdate) your composer before creation of any issue
Author
Owner

@svscorp commented on GitHub (May 2, 2013):

Already done before sending my second message. And yes it not fix this problem.

<!-- gh-comment-id:17335638 --> @svscorp commented on GitHub (May 2, 2013): Already done before sending my second message. And yes it not fix this problem.
Author
Owner

@svscorp commented on GitHub (May 2, 2013):

@stof It is just to try. I tried it because monolog/composer.json contains:

"require-dev": {
        "mlehner/gelf-php": "1.0.*",
        "raven/raven": "0.3.*",
        "doctrine/couchdb": "dev-master"
    },

So, it is logically to run it with --dev command, right?

<!-- gh-comment-id:17335750 --> @svscorp commented on GitHub (May 2, 2013): @stof It is just to try. I tried it because monolog/composer.json contains: ``` json "require-dev": { "mlehner/gelf-php": "1.0.*", "raven/raven": "0.3.*", "doctrine/couchdb": "dev-master" }, ``` So, it is logically to run it with --dev command, right?
Author
Owner

@svscorp commented on GitHub (May 2, 2013):

@stof and the second reason. File monolog/tests/bootstrap.php contains this:

$loader = require_once __DIR__ . "/../vendor/autoload.php";

So if I run tests for monolog it try to access /monolog/vendor/...
So again it is logically for me, that probably author consider sub-vendor folder...

But yes, I thout about placing 'gelf' requirement in general composer.json, but didn't tried it before.

I gonna try. But this is unlogical :) If you put something into composer.json of a dependent module it is means it should automatically install this dependecy if I set --dev key.

<!-- gh-comment-id:17335956 --> @svscorp commented on GitHub (May 2, 2013): @stof and the second reason. File monolog/tests/bootstrap.php contains this: ``` php $loader = require_once __DIR__ . "/../vendor/autoload.php"; ``` So if I run tests for monolog it try to access /monolog/vendor/... So again it is logically for me, that probably author consider sub-vendor folder... But yes, I thout about placing 'gelf' requirement in general composer.json, but didn't tried it before. I gonna try. But this is unlogical :) If you put something into composer.json of a dependent module it is means it should automatically install this dependecy if I set --dev key.
Author
Owner

@stof commented on GitHub (May 2, 2013):

@svscorp No. require-dev is only used in your root composer.json, not in your deps.

And when running the Monolog tests, you are expected to run composer with Monolog being the root package, not with monolog installed as a dependency.

<!-- gh-comment-id:17338625 --> @stof commented on GitHub (May 2, 2013): @svscorp No. require-dev is only used in your root composer.json, not in your deps. And when running the Monolog tests, you are expected to run composer with Monolog being the root package, not with monolog installed as a dependency.
Author
Owner

@svscorp commented on GitHub (May 2, 2013):

@stof yep, it helps. Thanks!

<!-- gh-comment-id:17338639 --> @svscorp commented on GitHub (May 2, 2013): @stof yep, it helps. Thanks!
Author
Owner

@svscorp commented on GitHub (May 2, 2013):

@stof Yeah, but I ran composer update with dev key from root. That's the case.

<!-- gh-comment-id:17338701 --> @svscorp commented on GitHub (May 2, 2013): @stof Yeah, but I ran composer update with dev key from root. That's the case.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#63
No description provided.