Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a system property to configure the daemon log level #12223

Closed
wants to merge 4 commits into from

Conversation

wolfs
Copy link
Member

@wolfs wolfs commented Feb 13, 2020

Related to #2688

Currently, the daemon always logs with DEBUG log level in the daemon log. This was fine up to now (mostly), since not much happened between builds.

When file watching is enabled, a lot happens between builds - file changes are collected. In order to prevent the daemon log to overflow, it should be possible to set the log level differently - e.g. to INFO.

This PR introduces a system property org.gradle.daemon.loglevel which the daemon tries to pick up from the current build context and then changes the logging level after the build accordingly.

@wolfs wolfs self-assigned this Feb 13, 2020
@wolfs wolfs force-pushed the wolfs/configure-daemon-log-level branch from e4cd3b9 to 78e199b Compare February 13, 2020 14:27
@wolfs wolfs marked this pull request as ready for review February 13, 2020 14:38
@wolfs wolfs requested a review from lptr February 13, 2020 14:38
Copy link
Member

@lptr lptr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can't we simulate org.gradle.daemon.disable-output by setting the log level to OFF now?

@wolfs
Copy link
Member Author

wolfs commented Feb 13, 2020

No, org.gradle.daemon.disable-output only disables the output to the console while the build is running, not to the daemon log.

@lptr
Copy link
Member

lptr commented Feb 13, 2020

In that case I think we should re-initialize the log level before we check that switch.

@wolfs wolfs force-pushed the wolfs/configure-daemon-log-level branch from 78e199b to 87b3022 Compare February 13, 2020 17:06
@wolfs
Copy link
Member Author

wolfs commented Feb 13, 2020

If we re-initialize logging before checking org.gradle.daemon.disable-output, then setting the logging doesn't work anymore, since stopping the logging router will reset the logging to the previous state, which is whatever the daemon had at the beginning.

@wolfs
Copy link
Member Author

wolfs commented Feb 14, 2020

Switching to info doesn't seem feasible, since then we lose the timestamps in the daemon logs, which seem to be important for users. It seems hard to produce timestamps with info logging in the daemon logs, since the logs are emitted by StyledTextOutputBackedRenderer for all consumers, and those either contain the timestamps (debug log), or they don't. All the meta-data is lost for the downstream consumers of the log messages.

Closing this PR.

@wolfs wolfs closed this Feb 14, 2020
@wolfs wolfs deleted the wolfs/configure-daemon-log-level branch February 3, 2021 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants