private void logErrorsFile(byte[] data) throws IOException {
        if (ProduceCSV.produceLog) {
            if (errorsFile.size() == 0) {
                return;
            }

            if (fileErrorLog == null) {
                openErrorLogFile();
            }

            fileErrorLog.println("------");
            fileErrorLog.println(parameterData.jobName);
            for (String error : errorsFile) {
                fileErrorLog.println(error);
            }
            fileErrorLog.println(new String(data));
            fileErrorLog.flush();
        }
    }