[ofbiz-framework] branch trunk updated: Improved: Gradle logging hygiene (OFBIZ-12085)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Gradle logging hygiene (OFBIZ-12085)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 99a446c  Improved:  Gradle logging hygiene (OFBIZ-12085)
99a446c is described below

commit 99a446c7b69ef4fe9e1c53cc6d38c7a34e85754e
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Fri Dec 11 17:58:54 2020 +0100

    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
---
 build.gradle | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/build.gradle b/build.gradle
index 8737b78..3da4cae 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1095,3 +1095,12 @@ def taskExistsInproject(fullyQualifiedProject, taskName) {
 def gradlewSubprocess(commandList) {
     exec { commandLine(gradlew, "--no-daemon", *commandList) }
 }
+
+
+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()
+    }
+}