Added a destination file to set_log function.
Added sql string to error handling calls.