error logging for sql problem