Sending event if an error occurred in Joomla

Is there a way to dispatch an event and call a method when an error similar to Zend occurs in joomla? I want to log this error in a log file. I want to use one method to catch every error. Is it possible?

Is there any other way to do this besides JError, please suggest.

+4
source share
2 answers

To log errors in a file, you can use the following:

jimport('joomla.log.log');

// Log errors to specific file.
JLog::addLogger(
   array(
      'text_file' => 'mod_mymodule.errors.php'
   ),
   JLog::ALL,
   'mod_mymodule'
);

This will create the following and save all the error there:

root/logs/mod_mymodule.errors.php

You can, of course, change mod_mymodule to whatever you want.

Hope this helps

+1

, JError , . .

0

Source: https://habr.com/ru/post/1529996/


All Articles