Improved: Gradle logging hygiene (OFBIZ-12085)

Some times ago, we were forced to stop and quickly restart the demos because of
the Gradle daemons logging taking all the place; though we don't use Gradle
daemons in demos. Weird isn't ?

The reason is that by default org.gradle.logging.level=lifecycle is verbose.
Anyway, all org.gradle.logging.level are verbose. I mean they also duplicate
OFBiz information, have a look into your own Gradle daemon dir!

And that even if you don't use daemons, as we do for demos. Because Gradle
always uses at least 1 daemon to run.

So I was looking for a solution to not uselessly clutter the VM disk demos and
stumbled upon <<Gradle logging hygiene - Issue #2688>> - gradle/gradle (github.com)

This uses Evgeny Naumenko's solution at
https://discuss.gradle.org/t/gradle-daemon-produces-a-lot-of-logs/9905

I backport because it's needed by demos

# Conflicts:
#	build.gradle

# Conflicts:
#	build.gradle
This commit is contained in:
Jacques Le Roux
2020-12-11 18:01:29 +01:00
parent ce2f66b720
commit 71ff63a043
+9
View File
@@ -1161,3 +1161,12 @@ def gradlewSubprocess(commandList) {
fullCommand.addAll(commandList)
exec { commandLine fullCommand }
}
def gradle = project.getGradle()
new File("${gradle.getGradleUserHomeDir().getAbsolutePath()}/daemon/${gradle.getGradleVersion()}").listFiles().each {
if (it.getName().endsWith('.out.log')) {
logger.debug("Cleaning up daemon log file $it")
it.delete()
}
}