synchronized void setLogFile(File logFile) {
		try {
			if (logFile == null) {
				if (logWriter != null) {
					writeLog("INFO", "File logging disabled");
					logWriter.close();
					logWriter = null;
				}
				return;
			}
			PrintWriter w = new PrintWriter(new FileWriter(logFile));
			if (logWriter != null) {
				writeLog("INFO ", "Switching log file to: " + logFile);
				logWriter.close();
			}
			logWriter = w;
		}
		catch (IOException e) {
			System.err.println("Failed to open log file " + logFile + ": " + e.getMessage());
		}
	}
Custom headless error logger which is used when log4j is disabled.
Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessErrorLogger.java