It's as simple as adding an
onError
function to your app_model.php
file, and whenever there is a database error, the error in the database will be logged in your CakePHP log.
Edit
/app/app_model.php
and add the following function:
public function onError() { $db = ConnectionManager::getDataSource('default'); $err = $db->lastError(); $this->log($err); $this->log($this->data); }