public void writeLog()
    {
        File file = new File(id + ".system.log");

        try {
            if (!file.exists()) {
                file.createNewFile();
            }

            FileWriter fw = new FileWriter(file.getAbsoluteFile(), false);
            BufferedWriter bw = new BufferedWriter(fw);

            for (AbstractMessage m : messageLog) {
                if (m instanceof AbstractJobMessage) {
                    bw.write(((AbstractJobMessage) m).toString() + "\n");
                } else {
                    bw.write(m.toString() + "\n");
                }
            }

            bw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }