/**
 * Implements the Cold Fusion Function writeoutput
 */
package railo.runtime.functions.other;


import java.io.PrintStream;

import railo.runtime.PageContext;
import railo.runtime.ext.function.Function;

public final class SystemOutput implements Function {
    public static boolean call(PageContext pc , String string) {
        return call(pc, string, false,false);
    }
    public static boolean call(PageContext pc , String string, boolean addNewLine) {
        return call(pc, string, addNewLine, false);
    }
    public static boolean call(PageContext pc , String string, boolean addNewLine,boolean doErrorStream) {
    	PrintStream stream = System.out;
    	//string+=":"+Thread.currentThread().getId();
    	if(doErrorStream) stream = System.err;
        
    	if(addNewLine)stream.println(string);
        else stream.print(string);
        return true;
    }
}
@@ -763,17 +763,200 @@
         
-%0A
+if(%22%3Cprint-stack-race%3E%22.equalsIgnoreCase(string))%7B%0A        %09new Exception(%22Stack trace%22).printStackTrace(stream);%0A        %09if(addNewLine)stream.println();%0A        %7D%0A        else %7B%0A    
     %09if(
@@ -994,24 +994,25 @@
 g);%0A        
+%09
 else stream.
@@ -1030,24 +1030,31 @@
 g);%0A        
+%7D%0A    %09
 return true;

add posibility to print the current stacktrace via function SystemOutput