[glow=red,2,300][Now SOLVED, see below][/glow]
For testing, I would like an SQL error log on the server, so that when an SQL query fails, I can see the error message and the query that caused it. Basically, I would feel more confident if I knew that there were no SQL errors going undetected behind the scenes in CMSMS or its Modules.
It seems MySQL cannot be configured to keep such an error log: it expects client-side code to do that. The MySQL server log records only catastrophic server messages: not SQL query errors.
Three ideas:-
1) Override the PHP error handler, to log SQL errors to disk.
2) Change how ADODB Lite is initialized by CMSMS, using ADODB's error handling functions to log SQL errors to disk.
3) Patch the MySQL source code, to make the server log include SQL errors.
Can anyone help with this?
Thanks for any ideas!
- Martin.
[SOLVED] MySQL Error Log wanted
[SOLVED] MySQL Error Log wanted
Last edited by martin42 on Tue Jun 03, 2008 7:01 am, edited 1 time in total.
Re: OT: MySQL Error Log wanted
Not sure if it does what you want but AdoDB lite has an own debug consolemartin42 wrote: 2) Change how ADODB Lite is initialized by CMSMS, using ADODB's error handling functions to log SQL errors to disk.
http://adodblite.sourceforge.net/debugconsole.php
You have only to activate it

[SOLVED]: MySQL Error Log wanted
Solved 
http://adodblite.sourceforge.net/errorhandler.php describes the ADODB error handling functions. The problem I had was that you need to comment out the references to raiseErrorFn if you want to use those error handling functions.
The following diff, applied to lib/adodb.functions.php in CMSMS 1.3 beta, will turn on full SQL error logging to your PHP log file. You get to see the full SQL error message plus the full query that caused it.

http://adodblite.sourceforge.net/errorhandler.php describes the ADODB error handling functions. The problem I had was that you need to comment out the references to raiseErrorFn if you want to use those error handling functions.
The following diff, applied to lib/adodb.functions.php in CMSMS 1.3 beta, will turn on full SQL error logging to your PHP log file. You get to see the full SQL error message plus the full query that caused it.
Code: Select all
diff -u4bB adodb.functions.php.orig adodb.functions.php
--- adodb.functions.php.orig 2008-06-03 07:25:58.000000000 +0100
+++ adodb.functions.php 2008-06-03 08:08:40.000000000 +0100
@@ -53,19 +53,23 @@
function & adodb_connect()
{
global $config;
+ error_reporting(E_ALL);
+ include("adodb_lite/adodb-errorhandler.inc.php");
+ define('ADODB_ERROR_LOG_TYPE', 0);
+
$dbinstance =& ADONewConnection($config['dbms'], 'pear:date:extend:transaction');
- $dbinstance->raiseErrorFn = "adodb_error";
+ //$dbinstance->raiseErrorFn = "adodb_error";
$conn_func = (isset($config['persistent_db_conn']) && $config['persistent_db_conn'] == true) ? 'PConnect' : 'Connect';
$connect_result = $dbinstance->$conn_func($config['db_hostname'], $config['db_username'], $config['db_password'], $config['db_name']);
if (FALSE == $connect_result)
{
die();
}
- $dbinstance->raiseErrorFn = null;
+ //$dbinstance->raiseErrorFn = null;
$dbinstance->SetFetchMode(ADODB_FETCH_ASSOC);
if ($config['debug'] == true)
Last edited by martin42 on Tue Jun 03, 2008 7:09 am, edited 1 time in total.