Consider a scenario where a java application error occurs and all you can see is an exception stack trace. Now, if you can re-create this issue somehow and turn your replay logs on, then use this replay log file to inject the exactly same state due to which the exception happened . I want to know if there an existing java library which can be used to do such a thing. Or Is it like will have to design my application such that it can cater to such requirements ?
For example consider the following class and the output. Now after parsing the output and using reflection I can exactly replay the div by 0 scenario.
So would like to know if there an existing java library which provides such functionality ?
public class MyClass {
    /**
     * @param args
     */
    public static void main(String[] args) {
        MyClass myClass = new MyClass();
        //Scenario 1
        int div1 = myClass.div(1,2);
        int div2 = myClass.div(1,0);
    }
    public int div(int firstArg,int secondArg){
        log(firstArg + "," + secondArg);
        return firstArg / secondArg;
    }
    private void log(String args){
        StringBuffer sb = new StringBuffer();
        sb.append("\nClass " + getClass().getName());
        sb.append(" Method " + getMethodName(1));
        sb.append(" Args " + args);
        System.out.println("LOG # " + sb.toString());
    }
    // picked from http://stackoverflow.com/questions/442747/getting-the-name-of-the-current-executing-method
    public static String getMethodName(final int depth)
    {
      final StackTraceElement[] ste = Thread.currentThread().getStackTrace();
      return ste[ste.length - 1 - depth].getMethodName(); //Thank you Tom Tresansky
    }
}
**
LOG # 
Class MyClass Method div Args 1,2
Exception in thread "main" LOG # 
Class MyClass Method div Args 1,0
java.lang.ArithmeticException: / by zero
    at MyClass.div(MyClass.java:19)
    at MyClass.main(MyClass.java:12)
**
 
    