Converted to using debug:print-error and added double printing of errors when output is sent to log file