added basic query logging for debugging

note that this requires config['log_level'] == 'DEBUG'