gpt4 book ai didi

sql - CakePHP 2 : Get full SQL error log in error. 日志

转载 作者:行者123 更新时间:2023-12-05 01:14:13 26 4
gpt4 key购买 nike

我希望能够在 error.log 中记录完整的 SQL 查询,特别是在发生 SQL 错误时。我的调试在 core.php 中设置为 2。

输出如下:

2013-01-29 19:53:21 Error: SQLSTATE[HY000]: General error: 1364 Field 'street' doesn't have a default value
#0 D:\xampp\htdocs\my_project\lib\Cake\Model\Datasource\DboSource.php(459): PDOStatement->execute(Array)
#1 D:\xampp\htdocs\my_project\lib\Cake\Model\Datasource\DboSource.php(425): DboSource->_execute('INSERT INTO `st...', Array)
#2 D:\xampp\htdocs\my_project\lib\Cake\Model\Datasource\DboSource.php(1007): DboSource->execute('INSERT INTO `st...')

如您所见,SQL 语句只记录了一部分,其余部分用省略号截断了。

我将 DebugKit 与此结合使用,但即使那样也不会在 DebugKit 窗口中及时生成完整的 SQL 日志。

我在这里抛出异常并记录 getTraceAsString() 。

任何解决方案将不胜感激。

谢谢你,
m^e

最佳答案

你可以尝试使用this question的答案.我知道这不是最佳答案,但在那个特定问题中你可以找到 this plugin这将为日志文件输出完整的 SQL。

关于sql - CakePHP 2 : Get full SQL error log in error. 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14583973/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com