[英]Dispatch an event if any error is occurred in Joomla
Is there any way to dispatch an event and call a method when an error is occurred in joomla same as Zend ? 有没有什么方法可以调度事件并在joomla中发生错误时调用方法与Zend相同? I want to log those error in log file.
我想在日志文件中记录这些错误。 I want to use a single method to catch every error.
我想使用单一方法来捕获每个错误。 is it possible ?
可能吗 ?
Is there any other way to do this except JError, Please suggest. 除了JError之外还有其他方法可以做到这一点吗,请建议。
To log errors to 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 store all error there: 这将创建以下内容并存储所有错误:
root/logs/mod_mymodule.errors.php
You can of course change mod_mymodule to whatever you wish. 您当然可以将mod_mymodule更改为您想要的任何内容。
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.