【发布时间】:2013-08-02 08:37:21
【问题描述】:
public class myclass
{
// Main method
public static void main (String args[])
{
// Stream to write file
try {
int a=100;
int b=a/0;
System.out.println(b);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
这是我的代码,我想打印 E:\logfile.txt 中出现的 Evre 异常。请帮助我,我无法做到这一点。
【问题讨论】:
-
你需要替换
e.printStackTrace... -
你有什么理由不想使用一些日志框架,例如Log4j?
-
我将如何替换。 printStackTrace 请帮忙
-
实际上我必须在服务器上上传,Ever Exception 需要在 E:\\log.txt 的 .txt 文件中收集什么
-
@AnilKumar 这就是日志库所做的事情,重写一个可能会浪费时间。
标签: java