From 3b480cfb65e822381ce33c55b801edd031d4ef8a Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 9 Mar 2010 00:59:18 +0000 Subject: [PATCH] Added consle annotation support to SCM polling logs. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@28435 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/triggers/SCMTrigger.java | 11 +++++++++++ .../hudson/triggers/SCMTrigger/SCMAction/index.jelly | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/triggers/SCMTrigger.java b/core/src/main/java/hudson/triggers/SCMTrigger.java index cb958063d8..ff6a01d6a9 100644 --- a/core/src/main/java/hudson/triggers/SCMTrigger.java +++ b/core/src/main/java/hudson/triggers/SCMTrigger.java @@ -26,6 +26,7 @@ package hudson.triggers; import antlr.ANTLRException; import hudson.Util; import hudson.Extension; +import hudson.console.AnnotatedLargeText; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.Cause; @@ -37,12 +38,14 @@ import hudson.model.AdministrativeMonitor; import hudson.util.StreamTaskListener; import hudson.util.TimeUnit2; import hudson.util.SequentialExecutionQueue; +import org.apache.commons.jelly.XMLOutput; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.DataBoundConstructor; import java.io.File; import java.io.IOException; import java.io.PrintStream; +import java.nio.charset.Charset; import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -264,6 +267,14 @@ public class SCMTrigger extends Trigger { public String getLog() throws IOException { return Util.loadFile(getLogFile()); } + + /** + * Writes the annotated log to the given output. + * @since 1.350 + */ + public void writeLogTo(XMLOutput out) throws IOException { + new AnnotatedLargeText(getLogFile(),Charset.defaultCharset(),true,this).writeLogTo(0,out.asWriter()); + } } private static final Logger LOGGER = Logger.getLogger(SCMTrigger.class.getName()); diff --git a/core/src/main/resources/hudson/triggers/SCMTrigger/SCMAction/index.jelly b/core/src/main/resources/hudson/triggers/SCMTrigger/SCMAction/index.jelly index 823ffc1628..9cdb7b36a6 100644 --- a/core/src/main/resources/hudson/triggers/SCMTrigger/SCMAction/index.jelly +++ b/core/src/main/resources/hudson/triggers/SCMTrigger/SCMAction/index.jelly @@ -33,7 +33,10 @@ THE SOFTWARE. ${%Polling has not run yet.} -
${it.log}
+
+            
+            ${it.writeLogTo(output)}
+