public void saveToFileThreadSafe()
{

    String lineSeparator = System.getProperty("line.separator");

    String filename =
        "Log Files" + File.separator + new Date().toString().replace(":", ".")
         + " ~ " + filenameSuffix + ".txt";

    PrintWriter file = null;

    try{
        file = new PrintWriter(new FileWriter(filename, true));

        file.println(log.getText().replace("\n", lineSeparator));

        if (file != null) {file.close();}

    }
    catch(IOException e){

        //if the log file cannot be opened, just display an error message
        //no messages will be written to the file -- this is not a super
        //critical error and should happen rarely

        displayErrorMessage("Could not open log file: " + filename);
        if (file != null) {file.close();}

    }

}//end of ThreadSafeLogger::saveToFileThreadSafe