Skip to content

Commit

Permalink
[FIXED JENKINS-27392] Handling ConsoleLogFilter.
Browse files Browse the repository at this point in the history
Originally-Committed-As: 38cd1ea642bd45e45331e89c8cef7ffb8e3740fa
  • Loading branch information
jglick committed Mar 30, 2015
1 parent b304848 commit e3bea83
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -26,6 +26,7 @@

import hudson.EnvVars;
import hudson.Launcher;
import hudson.console.ConsoleLogFilter;
import hudson.model.Computer;
import hudson.model.Job;
import hudson.model.Node;
Expand All @@ -34,6 +35,7 @@
import hudson.util.StreamTaskListener;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -88,8 +90,12 @@ public abstract class DefaultStepContext extends StepContext {
la = new LogActionImpl(getNode(), Charset.defaultCharset());
getNode().addAction(la);
}

listener = new StreamTaskListener(new FileOutputStream(la.getLogFile(), true));
ConsoleLogFilter filter = get(ConsoleLogFilter.class);
OutputStream os = new FileOutputStream(la.getLogFile(), true);
if (filter != null) {
os = filter.decorateLogger(null, os);
}
listener = new StreamTaskListener(os);
getExecution().addListener(new GraphListener() {
@Override public void onNewHead(FlowNode node) {
try {
Expand Down

0 comments on commit e3bea83

Please sign in to comment.