added sql logging