From 7e7965460e201d99eddab74b6694ee969680bbcf Mon Sep 17 00:00:00 2001 From: "r.kislukhin" Date: Thu, 17 Oct 2019 15:58:12 +0300 Subject: [PATCH] Build log output to file --- build.gradle | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/build.gradle b/build.gradle index 088d4ea..cff5bc1 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,29 @@ dependencies { 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', '-config', 'ncore-properties.xml', '-config', 'ncore-properties-local.xml']