added query printing in log