Advertisement
HoussemNa12

Untitled

Feb 26th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. Thread t = new Thread(new MyRunnable());
  2. t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
  3.  
  4.     public void uncaughtException(Thread t, Throwable e) {
  5.        LOGGER.error(t + " throws exception: " + e);
  6.     }
  7. });
  8. t.start();
  9.  
  10. //outside that class
  11. class MyRunnable implements Runnable(){
  12.     public void run(){
  13.         throw new RuntimeException("hey you!");
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement