I am getting error "Call to a member function add() on a non-object" on Kohana::$log
There is not log in application/logs
directory. The error I described is found on apache error_log
. This is how it appears
[Fri Aug 17 17:07:09 2012] [error] [client MY.IPA.DDR.ESS] PHP Fatal error: Call to a member function add() on a non-object in /var/www/html/application/classes/kohana/exception.php on line 8
This is my error controller.
<?php
class Kohana_Exception extends Kohana_Kohana_Exception {
public static function handler(Exception $e) {
if (Kohana::DEVELOPMENT === Kohana::$environment) {
parent::handler($e);
} else {
try {
Kohana::$log->add(Log::ERROR, "own exception handler");
Kohana::$log->add(Log::ERROR, parent::text($e));
$attributes = array('action' => 500, 'message' => rawurlencode($e->getMessage()));
if ($e instanceof HTTP_Exception) {
$attributes['action'] = $e->getCode();
}
// Error sub-request.
echo Request::factory(Route::get('error')->uri($attributes))->execute()->send_headers()->body();
}
catch(Exception $e) {
// Clean the output buffer if one exists
ob_get_level() and ob_clean();
// Display the exception text
echo parent::text($e);
// Exit with an error status
exit(1);
}
}
}
}
From the code it seems Kohana::$log
is not initialized yet. But this code was working for long time. Now what made it not working?
I am using Kohana-3.2 with PHP 5.3.13 on Fedora 15