Improve the SQL logging a bit more.