php - joomla exceptions are not being logged -
i have joomla site, running 3.0.2* , have noticed exceptions caught joomla not being logged anywhere. using built-in database logging, initialized following code, placed within onafterinitialise function of custom plugin.
// initialize logging. jimport('joomla.log.log'); $config = jfactory::getconfig(); jlog::addlogger(array( 'logger' => 'database', 'db_driver' => $config->get('dbtype'), 'db_host' => $config->get('host'), 'db_user' => $config->get('user'), 'db_pass' => $config->get('password'), 'db_prefix' => $config->get('dbprefix'), 'db_database' => ctasettings::get('logging.db'), jlog::all, '' ));
ctasettings::get class method retrieves name of database used logging. can verify works correctly , commands such following being logged:
jlog::add(__line__. " - ". __file__, jlog::info, 'cat');
but, if exception thrown in component, nothing being logged. should joomla logging caught exceptions? , there way joomla's built-in error handling automatically log these things? have quite bit of custom code, , inconvenient if every custom component, plugin, , module had modified explicitly log errors thrown.
* we're working on upgrading, cannot @ moment.
i used seterrorhandling method enable exception logging. deprecated, understanding no alternative has yet been introduced. so, i'm going keep open, in case has better answer, following line of code fixed problem.
jerror::seterrorhandling(jlog::all & ~jlog::warning, 'log');
the & ~jlog::warning specify not log "such , such deprecated" errors. it's not ideal, seems answer works.
Comments
Post a Comment