@@ -0,0 +1,2356 @@
+package lucee.runtime.engine;%0A%0Aimport java.io.BufferedOutputStream;%0Aimport java.io.File;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0Aimport java.io.PrintWriter;%0Aimport java.util.Collections;%0Aimport java.util.IdentityHashMap;%0Aimport java.util.Set;%0A%0Aimport lucee.print;%0Aimport lucee.commons.io.IOUtil;%0Aimport lucee.commons.io.SystemUtil;%0Aimport lucee.commons.lang.ExceptionUtil;%0A%0Apublic class LogST extends Thread %7B%0A%09%0A%09private static final char NL = '%5Cn';%0A%09private Thread thread;%0A%09private long size=0;%0A%09private long max=1024*1024*100; %0A%09%0A%09public static void main(String%5B%5D args) throws InterruptedException %7B%0A%0A    %09print.e(%22----------- start ------------%22);%0A%09%09LogST log = new LogST(Thread.currentThread());%0A%09%09log.start();%0A%09%09log.join();%0A    %09print.e(%22----------- stop ------------%22);%0A%09%7D%0A%09%0A%09public LogST(Thread thread) %7B%0A%09%09this.thread=thread;%0A%09%7D%0A%09%0A%09public void run() %7B%0A%09%09PrintStream ps=null;%0A%09%09try %7B%0A%09%09%09ps=new PrintStream(createFile());%0A%09%09%09while(true) %7B%0A%09%09%09%09printStackTrace(ps,thread.getStackTrace());%0A%09%09%09%09SystemUtil.sleep(10);%0A%09%09%09%09if(size%3Emax) %7B%0A%09%09%09%09%09IOUtil.closeEL(ps);%0A%09%09%09%09%09ps=new PrintStream(createFile());%0A%09%09%09%09%09size=0;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09finally %7B%0A%09%09%09IOUtil.closeEL(ps);%0A%09%09%7D%0A%09%09print.e(%22----------- done ------------%22);%0A%09%7D%0A%09%0A%09%0A    private File createFile() throws IOException %7B%0A    %09File f;%0A    %09int count=0;%0A    %09while((f=new File(%22/Users/mic/stacktrace-%22+(++count)+%22.log%22)).isFile()) %7B%0A    %09%09%0A    %09%7D%0A    %09print.e(f.getCanonicalPath());%0A%09%09return f;%0A%09%7D%0A%0A%09private void printStackTrace(PrintStream ps, StackTraceElement%5B%5D trace) %7B%0A    %09%0A        %0A        %7B%0A        %09String line;%0A            // Print our stack trace%0A        %09String head=System.currentTimeMillis()+%22%5Cn%22;%0A        %09ps.print(head);%0A        %09size += head.length();%0A        %09for (StackTraceElement traceElement : trace) %7B%0A            %09line=%22%5Ctat %22 + traceElement+%22%5Cn%22;%0A                ps.print(line);%0A                size += line.length();%0A            %7D%0A            ps.print(NL);%0A            ps.flush();%0A            size+=1;%0A            %0A        %7D%0A    %7D%0A%0A%09public static void _do() %7B%0A%0A    %09print.e(%22----------- start ------------%22);%0A%09%09LogST log = new LogST(Thread.currentThread());%0A%09%09log.start();%0A%09%09//log.join();%0A    %09print.e(%22----------- stop ------------%22);%0A%09%7D%0A%7D%0A

add stack trace logger