add sql log,open it if necessary.