Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fatal error when using class \Fuel\Core\Log
  • Is it necessary to load Monolog/Logger in config.php or bootstrap.php specifically?  
    My Autoloader can not find it, and eventually after initializing \Fuel\Core\Log I have static::$monolog = null

    My actions in controller:
    Log::error('Some error message');

    What i see:
    ErrorException [ Fatal Error ]:
    Call to a member function log() on null

    D:/xampp/htdocs/testsite/fuel/core/classes/log.php @ line 244

    line 244: static::instance()->log($level, (empty($method) ? '' : $method.' - ').$msg);
  • Sounds like you haven't run composer?
  • No, I ran `composer update` more than once. 

    composer.json contains:
    "require": {
    "monolog/monolog": "1.18.*",
    Folder /fuel/vendor/monolog/monolog exists. I have place breakpoints in Autoloader::load() and can't find 'Monolog\Logger' neither in `static::$classes` nor in `static::$core_namespaces`.

    I use namespacing if it matters.

    Here is my /fuel/app/bootstrap.php:
    require COREPATH.'bootstrap.php';
    \Autoloader::add_classes([ // some classes replacements ]);
    require APPPATH.'vendor/autoload.php';
    \Fuel::$env = \Arr::get($_SERVER, 'FUEL_ENV', \Arr::get($_ENV, 'FUEL_ENV', \Fuel::DEVELOPMENT));
    require APPPATH.'functions.php';

  • Hmmm, it works fine on fresh installation. I have no idea where i could break it.
  • Currently commented out all my own changes in bootstrap.php and then uncommented it. 
    Now it works. Sounds like cached something buggy in Autoloader.
  • HarroHarro
    Accepted Answer
    What version of Fuel are you on?

    The current version 1.8.x doesn't require loading the composer autoloader anymore, putting it there will definitely break it.


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion