提交 bb9ae0b9 编写于 作者: K Kohsuke Kawaguchi

added more logging

上级 4934ff3a
...@@ -58,6 +58,7 @@ import java.lang.reflect.Method; ...@@ -58,6 +58,7 @@ import java.lang.reflect.Method;
import static hudson.model.queue.Executables.*; import static hudson.model.queue.Executables.*;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static java.util.logging.Level.FINE;
/** /**
...@@ -205,14 +206,19 @@ public class Executor extends Thread implements ModelObject { ...@@ -205,14 +206,19 @@ public class Executor extends Thread implements ModelObject {
synchronized (queue) { synchronized (queue) {
workUnit = grabJob(); workUnit = grabJob();
workUnit.setExecutor(this); workUnit.setExecutor(this);
if (LOGGER.isLoggable(FINE))
LOGGER.log(FINE, getName()+" grabbed "+workUnit+" from queue");
task = workUnit.work; task = workUnit.work;
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
executable = task.createExecutable(); executable = task.createExecutable();
} }
if (LOGGER.isLoggable(FINE))
LOGGER.log(FINE, getName()+" is going to execute "+executable);
} catch (IOException e) { } catch (IOException e) {
LOGGER.log(Level.SEVERE, "Executor threw an exception", e); LOGGER.log(Level.SEVERE, "Executor threw an exception", e);
continue; continue;
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOGGER.log(FINE, getName()+" interrupted",e);
continue; continue;
} }
...@@ -227,6 +233,8 @@ public class Executor extends Thread implements ModelObject { ...@@ -227,6 +233,8 @@ public class Executor extends Thread implements ModelObject {
} }
} }
setName(threadName+" : executing "+executable.toString()); setName(threadName+" : executing "+executable.toString());
if (LOGGER.isLoggable(FINE))
LOGGER.log(FINE, getName()+" is now executing "+executable);
queue.execute(executable, task); queue.execute(executable, task);
} catch (Throwable e) { } catch (Throwable e) {
// for some reason the executor died. this is really // for some reason the executor died. this is really
...@@ -238,6 +246,8 @@ public class Executor extends Thread implements ModelObject { ...@@ -238,6 +246,8 @@ public class Executor extends Thread implements ModelObject {
} finally { } finally {
setName(threadName); setName(threadName);
finishTime = System.currentTimeMillis(); finishTime = System.currentTimeMillis();
if (LOGGER.isLoggable(FINE))
LOGGER.log(FINE, getName()+" completed "+executable+" in "+(finishTime-startTime)+"ms");
try { try {
workUnit.context.synchronizeEnd(executable,problems,finishTime - startTime); workUnit.context.synchronizeEnd(executable,problems,finishTime - startTime);
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册