protected void checkLogFile() {
        if (printWriter != null)
            return;
        try {
            printWriter = new PrintWriter( new BufferedWriter(new FileWriter(logFilePath)));
        }
        catch (IOException e) {
            System.err.println("Error creating log file " + logFilePath);
            System.err.println(e);
        }
        catch (SecurityException e) {
            System.out.println("Security policy does not permit a log file.");
            writeToFile = false;
        }
    }