1

重複の可能性:
Java: グローバル例外ハンドラ

私は次のようなことを考えました:

public static void main(String[] args) {
  try {
    startOfMyProg();
  } catch (RuntimeException e) {
     log.error(e.toString());
     // Maybe rethrow it so i can see it in the console?
  }
}

それは簡単な解決策です、私は知っています。多分誰かがより良いものを知っていますか?

よろしく && tia noircc

4

1 に答える 1

3

私は...するだろう

} catch (Throwable e) {
    log.error("Uncaught exception", e); // prints the stack trace.
于 2012-06-21T08:32:32.503 に答える