private static LogData initializeLog(Class<?> testClass) throws FileNotFoundException {

		try {
			LogData data = logDataMap.get(testClass);
			if (data == null) {
				data = new LogData();
				logDataMap.put(testClass, data);

				data.testResults = combinedResults.getTestResults(testClass.getSimpleName(), true);
				data.testResults.clear();

				data.traceFile = new File(logDir, testClass.getSimpleName() + ".log");
				if (data.traceFile.exists()) {
					data.traceFile.delete();
				}

			}
			else {

				// Test has previously been run so we know ingest initialization has already been
				// completed.  If test class is switching we can flush that tests results to HTML
				// file.
				if (lastTestClass != null && !lastTestClass.equals(testClass)) {
					resultsWriter.run(); // write out html results on test change
				}

				if (data.traceLog != null) {
					return data;
				}
			}

			data.traceLog = new PrintWriter(new BufferedWriter(
				new OutputStreamWriter(new FileOutputStream(data.traceFile, true))));

			data.traceLog.println((new Date()).toString());

			return data;
		}
		finally {
			lastTestClass = testClass;
		}
	}
Converts the stack trace into a string
Ghidra/Features/Base/src/main/java/ghidra/test/processors/support/ProcessorEmulatorTestAdapter.java