Logging to file

Hi to all,

we are using gradle in all projects of our company having the requirement to have all log information be written to logfile build.log in our project path, always one loglevel more than written to console.

  • Start your build with no parameter -> INFO to file
  • Start your build with --info -> DEBUG to file
  • Start your build with --debug -> TRACE to file

We have worked around by configuring logback programmatically in our plugins at the very beginning of the build. Now switching to gradle 2.4 we noticed, that logback was replaced by minlog. So we rethought this workaround and we came to the question, if it would not be possible to have some official api to configure logging both for gradle built in plugins and our own plugins being not the only one to have this needs.

Would be nice, if you could tell me, how to handle this problem.

Best regards
Markus

Hi again,

with gradle 2.4 the situation is even worse.

In previous versions we have configured logback programmatically, which was a hack too, I know. But now it seems that lockback is not used anymore. The included MinLog seems to be not used either. The SLF4j and log4j is completely neuterilazed. So two questions, because we have already changed our implementation multiple times and want to change it in a future save kind:

  1. Do I currently have a possibility to reconfigure logging myself or to add listeners to the gradle logsystem, which can handle different loglevels, so I can work with these things?

  2. What is your vision for the future with logging. Do you want to use some framework, will you provide logging yourself?

Would be nice if I can get an answer. Looking around it seems that I am not the only one who is irritated with it.
Cheers
Markus

Hi Markus,

We’re having the same requirements with the addition to make sure all the output directed directly to stdout or stderr is captured in the log files as well.

Did you find a solution after all? We’re now working our way through internal APIs and various hacks to capture the direct console output but it does not fell quite right.

Thanks,
Endre

Hi Endre,

we have got no cool solution so far.
We have currently implemented our own logger, which is not captured by gradle via some bridge :slight_smile:
But we would still be interested in getting a real solution from gradleware by default

Cheers
Markus

Hi Markus,

Thanks for the prompt answer :slight_smile:

We thought about this approach as well but what really concerns me is the direct output. Unfortunately some plugins and libraries write directly to the console without using the logger system. Have found a solution for that? We tried to define OutputEventListener (through some internal API …) but it seems that even though we trying to use logging.captureStandardError and logging.captureStandardOutput the direct outputs do not get to the log event listeners.

We as well look forward for some feedback from gradleware but in the meantime we really appreciate your help!

Cheers,
Endre

Hi Endre,

no sorry - we have learned to live without having logs for things which are not from our plugins. It’s not ideal, but gradleware doesn’t want to write things in logfile.

Sorry, that I cannot give you more help,
Cheers
Markus