Created
October 1, 2013 12:02
-
-
Save willis7/6777425 to your computer and use it in GitHub Desktop.
Add Standard Output/Error listeners and pipe their output to a build log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss') | |
def buildLogDir = "${rootDir}/build/logs" | |
mkdir("${buildLogDir}") | |
def buildLog = new File("${buildLogDir}/${tstamp}_buildLog.log") | |
import org.gradle.logging.internal.* | |
System.setProperty('org.gradle.color.error', 'RED') | |
gradle.services.get(LoggingOutputInternal).addStandardOutputListener (new StandardOutputListener () { | |
void onOutput(CharSequence output) { | |
buildLog << output | |
} | |
}) | |
gradle.services.get(LoggingOutputInternal).addStandardErrorListener (new StandardOutputListener () { | |
void onOutput(CharSequence output) { | |
buildLog << output | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment