Changed the log record insertion to a prepared statement. close #464