Added some commands to log the SQL queries