From a98cd90f1e5889fa586205d12c65209f91361cab Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Thu, 6 Mar 2014 12:26:17 +0100 Subject: truncate large queries for slow log --- it_dbi.class | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 57c64a3..7425275 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -483,7 +483,8 @@ function query($query, $p = array()) if ($GLOBALS['debug_sqllog'] || $GLOBALS['debug_sqltrace'] || $slow) { $backtrace = (EDC('sqltrace') || $slow) ? it_debug::backtrace(1) : null; - it::log('sqllog', "$msec\t$query\t$backtrace\t" . $this->_p['server'] . ($slow ? "\tSLOW" : "")); + $truncquery = strlen($query) > 1000 ? mb_substr($query, 0, 1000) . '...' : $query; + it::log('sqllog', "$msec\t$truncquery\t$backtrace\t" . $this->_p['server'] . ($slow ? "\tSLOW" : "")); $this->_sqllog[] = array( 'time' => $msec, -- cgit v1.2.3