Skip to content
Permalink
Browse files

[FIXED JENKINS-27392] Handling ConsoleLogFilter.

  • Loading branch information
jglick committed Mar 30, 2015
1 parent 05916af commit 38cd1ea642bd45e45331e89c8cef7ffb8e3740fa
@@ -46,6 +46,7 @@
* <dl>
* <dt>{@link EnvVars}<dd>use {@link EnvironmentExpander} instead
* <dt>{@link EnvironmentExpander}<dd>use {@link EnvironmentExpander#merge}
* <dt>{@link ConsoleLogFilter}<dd>merge two instances if present; your implementation should expect {@code null} for the {@code build} parameter, and be {@link Serializable}
* </dl>
* @see StepContext#get(Class)
*
@@ -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;
@@ -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;
@@ -88,8 +90,12 @@
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 {

0 comments on commit 38cd1ea

Please sign in to comment.
You can’t perform that action at this time.