Gradle daemon produces a lot of logs

We’re using gradle daemon for some time and are quite happy with it, as it significantly speeds up the build.

It turned out, however, that gradle daemon logs every build within ~/.gradle/daemon/2.4/daemon-XXXX.out and these files are never cleared. Given that our build produces ~250M of debug output, these logs may ate up the entire partition, just like like it happened on our build server today. Of course it’s possible to remove-d option from buildserver builds, but I’d prefer to keep it to ease failed builds investigation.

Q: Is there a way I can prevent gradle daemon from logging into it’s own folder? Or at least enforce some policy to rotate/cleanup these files?

Thanks in advance for your time and effort.

3 Likes

Hi,

There’s no hygiene around this right now unfortunately. You’ll have to implement your own cleanup procedure.

Hi Luke,

Thanks for clarification on that matter.
I ended up with the following cleaning routine in my build script:

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()
    }
}
1 Like

Hi,

has there been any progress on hygiene around the gradle-daemon?

These logs are huge. Progress should be made in this area.