Debug logging to file

Having the debug logging output is often useful in figuring out build problems, but is also very verbose and obscures the normal gradle output. It would be nice if the --debug command line arg allowed an optional filename to send the output to. This way you could still see the normal gradle output, but can capture the debugging log messages for later viewing.

Perhaps an alternative would be to allow configuration of the logging output via the build file. I am guessing that there is something like slf4j used under the hood, and so should be configurable, but it wasn’t clear from the documentation. Chapter 18 gives help on how to write log messages, but not much on how to configure the output side of the logging system (or even what it is).


can’t you just redirect the ouput to a file with > ?

For example. gradle --debug > debug.txt

I’m interested in sending logs on socket (to OtrosLogViewer). Do you know any logging configuration file for Gradle?

Gradle doesn’t currently expose a logging configuration file. What you could do is to pipe the Gradle output to another process which then forwards it via the socket.

THanks Peter for quick response. I have been able to import Gradle logs to OtrosLogViewer using redirection to file.