Build log output to file

This commit is contained in:
2019-10-17 15:58:12 +03:00
parent 7f2713129d
commit 7e7965460e

View File

@ -43,6 +43,29 @@ dependencies {
testCompile 'junit:junit:4.+' testCompile 'junit:junit:4.+'
} }
// writing build process to a log file
// --------------------- BUILD LOG SETTINGS ----------------------
def tstamp = new Date().format('yyyy-MM-dd_HH-mm-ss')
def buildLogDir = "${rootDir}/logs"
mkdir("${buildLogDir}")
def buildLog = new File("${buildLogDir}/${tstamp}_buildLog.log")
import org.gradle.internal.logging.*
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
}
})
// --------------------- BUILD LOG SETTINGS ----------------------
run.args = ['client', run.args = ['client',
'-config', 'ncore-properties.xml', '-config', 'ncore-properties.xml',
'-config', 'ncore-properties-local.xml'] '-config', 'ncore-properties-local.xml']