@@ -0,0 +1,951 @@
+package com.fatico.winthing.logging;%0A%0Aimport java.util.Arrays;%0Aimport java.util.concurrent.ConcurrentLinkedQueue;%0A%0Aimport com.fatico.winthing.gui.WindowGUI;%0A%0Aimport ch.qos.logback.classic.spi.ILoggingEvent;%0Aimport ch.qos.logback.core.ConsoleAppender;%0A%0Apublic class ConsoleLogger extends ConsoleAppender%3CILoggingEvent%3E %7B%0A%09private static final int LOG_SIZE = 50;%0A%09private static ConcurrentLinkedQueue%3CString%3E events = new ConcurrentLinkedQueue%3CString%3E();%0A%09%0A%09public static String getEvents() %7B%0A%09%09if (events.size() == 0) %7B%0A%09%09%09return %22%22;%0A%09%09%7D%0A%09%09%0A%09%09String%5B%5D logs = new String%5Bevents.size()%5D;%0A%09%09events.toArray(logs);%09%09%0A%09%09%0A%09%09String result = Arrays.toString(logs);%0A%09%09%0A%09%09return result;%0A%09%7D%0A%09%0A%09protected void append(ILoggingEvent event) %7B%0A%09%09super.append(event);%0A%09%09%0A%09%09if (events.size() %3E LOG_SIZE) %7B%0A%09%09%09events.remove();%0A%09%09%7D%0A%09%09%0A%09%09byte%5B%5D data = encoder.encode(event);%0A%09%09events.add(new String(data));%0A%09%09%0A%09%09WindowGUI gui = WindowGUI.getInstance();%0A%09%09gui.reload();%0A%09%7D%0A%7D%0A

Enable logging to a GUI console window