Database: Add logging for queries