e.printStackTrace(new PrintStream(new FileOutputStream("error.txt")));

解决方案 »

  1.   

    e.printStackTrace(new PrintStream(new FileOutputStream("error.log", true)));
      

  2.   

    要追加的话应该这样
    e.printStackTrace(new PrintStream(new FileOutputStream("error.txt",true)));
      

  3.   


    文件操作肯定会有异常的,只能捕捉或抛出去
    try{e.printStackTrace(new PrintStream(new FileOutputStream("error.txt",true)));}catch (FileNotFoundException e1){e1.printStackTrace();}
    再说这也只是一行代码
      

  4.   


    文件操作肯定会有异常的,只能捕捉或抛出去
    try{e.printStackTrace(new PrintStream(new FileOutputStream("error.txt",true)));}catch (FileNotFoundException e1){e1.printStackTrace();}
    再说这也只是一行代码
    。多谢了。
      

  5.   


    文件操作肯定会有异常的,只能捕捉或抛出去
    try{e.printStackTrace(new PrintStream(new FileOutputStream("error.txt",true)));}catch (FileNotFoundException e1){e1.printStackTrace();}
    再说这也只是一行代码
    。多谢了。其实还有别的办法