PLD: add sql query logging middleware

for debugging on staging