static void logOutput2() { File _logFile = null; while licensed { _logFile = getProgramFile(ymd() + "-" + hms() + ".txt"); if (_logFile.exists()) sleep(50); else break; } final File logFile = _logFile; set(getJavaX(), "customSystemOut", new Appendable() { // only using this one public Appendable append(CharSequence cs) { appendToTextFile(logFile, cs.toString()); return this; } public Appendable append(char c) { return this; } public Appendable append(CharSequence s, int start, int end) { return this; } }); }