[ofbiz-framework] branch release17.12 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 release17.12 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 release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 71ff63a  Improved:  Gradle logging hygiene (OFBIZ-12085)
71ff63a is described below

commit 71ff63a04381f0a912e949b5c80e99682d5eee5b
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
   
    # Conflicts:
    # build.gradle
   
    # Conflicts:
    # build.gradle
---
 build.gradle | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/build.gradle b/build.gradle
index bd6c3ca..069b574 100644
--- a/build.gradle
+++ b/build.gradle
@@ -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()
+    }
+}