Log SQL statements on shutdown, preserve queue order on shutdown.