提交 0f3f6658 编写于 作者: K kohsuke

pass more structured logger

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9388 71c3de6d-444a-0410-be80-ed276b4c234a
上级 21faaf7a
......@@ -331,7 +331,7 @@ public final class Slave implements Node, Serializable {
*/
private void launch(final Slave slave) {
closeChannel();
slave.startMethod.launch(this, openLogFile());
slave.startMethod.launch(this, new StreamTaskListener(openLogFile()));
}
public OutputStream openLogFile() {
......@@ -591,7 +591,7 @@ public final class Slave implements Node, Serializable {
return false;
}
public void launch(ComputerImpl computer, OutputStream launchLog) {
public void launch(ComputerImpl computer, StreamTaskListener listener) {
// do nothing as we cannot self start
}
......@@ -649,13 +649,12 @@ public final class Slave implements Node, Serializable {
return String.format("[%1$tD %1$tT]", new Date());
}
public void launch(final ComputerImpl computer, final OutputStream launchLog) {
public void launch(final ComputerImpl computer, final StreamTaskListener listener) {
// launch the slave agent asynchronously
Computer.threadPoolForRemoting.execute(new Runnable() {
// TODO: do this only for nodes that are so configured.
// TODO: support passive connection via JNLP
public void run() {
final StreamTaskListener listener = new StreamTaskListener(launchLog);
try {
listener.getLogger().println(Messages.Slave_Launching(getTimestamp()));
listener.getLogger().println("$ " + getCommand());
......@@ -668,9 +667,9 @@ public final class Slave implements Node, Serializable {
// capture error information from stderr. this will terminate itself
// when the process is killed.
new StreamCopyThread("stderr copier for remote agent on " + computer.getDisplayName(),
proc.getErrorStream(), launchLog).start();
proc.getErrorStream(), listener.getLogger()).start();
computer.setChannel(proc.getInputStream(), proc.getOutputStream(), launchLog, new Listener() {
computer.setChannel(proc.getInputStream(), proc.getOutputStream(), listener.getLogger(), new Listener() {
public void onClosed(Channel channel, IOException cause) {
if (cause != null) {
cause.printStackTrace(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册