OSDN Git Service

Workerでエラーが発生した際にログ出力を行う
authoryukihane <yukihane.feather@gmail.com>
Sat, 17 Sep 2011 13:35:31 +0000 (22:35 +0900)
committeryukihane <yukihane.feather@gmail.com>
Sun, 18 Sep 2011 03:30:10 +0000 (12:30 +0900)
frontend/src/saccubus/worker/Worker.java

index 975eb18..b825014 100644 (file)
@@ -1,6 +1,8 @@
 package saccubus.worker;
 
 import java.util.concurrent.Callable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * 途中経過を報告できるCallableです.
@@ -14,6 +16,7 @@ import java.util.concurrent.Callable;
  */
 public abstract class Worker<T, V> implements Callable<T> {
 
+    private static final Logger logger = LoggerFactory.getLogger(Worker.class);
     private static int serialNumber = 0;
     private final int id;
     private final WorkerListener<T, V> listener;
@@ -37,6 +40,7 @@ public abstract class Worker<T, V> implements Callable<T> {
             }
             throw ex;
         } catch (Throwable th) {
+            logger.error("work error", th);
             if(listener != null){
                 listener.error(th);
             }