record error log for sql errors