public void logMessage(String message) { if (!needsLogging) return; checkLogFile(); println(message);
public synchronized void logMessage(String message, String logFileName) { if (LogWriter.needsLogging) { try { File logFile = new File(logFileName); if (!logFile.exists()) { logFile.createNewFile(); printWriter = null; }  FileWriter fw = new FileWriter(logFileName, true); PrintWriter printWriter = new PrintWriter(fw, true); printWriter.println( " ---------------------------------------------- "); printWriter.println(message); printWriter.close(); fw.close();  } catch (IOException ex) { ex.printStackTrace(); } }
	public void logMessage(String message) {		if (!needsLogging)			return;		checkLogFile();		println(message);	}