Skip to content

Instantly share code, notes, and snippets.

@Williammer
Forked from willis7/logging.gradle
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Williammer/177ce19e845ff52158f6 to your computer and use it in GitHub Desktop.
Save Williammer/177ce19e845ff52158f6 to your computer and use it in GitHub Desktop.
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