I have some problem with error logging in Kohana v2.3.4.
我在Kohana v2.3.4中记录错误时遇到了一些问题。
In the index.php I have kept the default settings:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
在index.php中,我保留了默认设置:error_reporting(E_ALL); ini_set('display_errors',TRUE);
In config.php I have set
$config['log_threshold'] = 3;
$config['display_errors'] = FALSE;
在config.php中我设置了$ config ['log_threshold'] = 3; $ config ['display_errors'] = FALSE;
The problem is kohana is not handling php syntax errors.
Instead the default php error message gets displayed on screen.
To stop error messages from getting displayed in production I have to set
问题是kohana没有处理php语法错误。而是在屏幕上显示默认的PHP错误消息。要阻止错误消息在生产中显示,我必须设置
error_reporting(0);
(0)使用error_reporting;
But this will suppress other errors(Ex: missing function arguments or undefined array index) from getting logged by kohana.
但这将抑制其他错误(例如:缺少函数参数或未定义的数组索引)被kohana记录。
In short
1. I want above mentioned errors(missing function arguments or undefined array index) to be logged by kohana.
2. I don't want php syntax errors to be displayed on screen.
简而言之1.我希望kohana记录上面提到的错误(缺少函数参数或未定义的数组索引)。 2.我不希望在屏幕上显示php语法错误。
Is it possible with kohana 2.3.4?
是否可以使用kohana 2.3.4?
1 个解决方案
#1
0
You need to overload the shutdown handler and check for an E_PARSE error. You can see an example of this code in the Kohana 3 Shutdown handler. All you need to do is get the error details from error_get_last()
and work from there.
您需要重载关闭处理程序并检查E_PARSE错误。您可以在Kohana 3 Shutdown处理程序中查看此代码的示例。您需要做的就是从error_get_last()获取错误详细信息并从那里开始工作。
The Kohana 2 Shutdown handler does no such checking.
Kohana 2关闭处理程序没有这样的检查。
Note: Since it's called the shutdown_handler you have to output or log the error. There's no chance your application will be carrying on.
注意:由于它被称为shutdown_handler,您必须输出或记录错误。您的申请无法继续进行。
Hoped that helped.
希望有所帮助。
#1
0
You need to overload the shutdown handler and check for an E_PARSE error. You can see an example of this code in the Kohana 3 Shutdown handler. All you need to do is get the error details from error_get_last()
and work from there.
您需要重载关闭处理程序并检查E_PARSE错误。您可以在Kohana 3 Shutdown处理程序中查看此代码的示例。您需要做的就是从error_get_last()获取错误详细信息并从那里开始工作。
The Kohana 2 Shutdown handler does no such checking.
Kohana 2关闭处理程序没有这样的检查。
Note: Since it's called the shutdown_handler you have to output or log the error. There's no chance your application will be carrying on.
注意:由于它被称为shutdown_handler,您必须输出或记录错误。您的申请无法继续进行。
Hoped that helped.
希望有所帮助。