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

Most logging is reduced to info level by default #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

erichaagdev
Copy link
Member

@erichaagdev erichaagdev commented Feb 18, 2025

The logging done by the init script is mainly used for testing purposes and not needed by consumers.

In cases where this additional logging is needed, e.g., for debugging injection in an environment, the property develocity.injection.debug=true can be used to enable it.

@erichaagdev erichaagdev requested a review from bigdaz February 18, 2025 21:37
@erichaagdev erichaagdev self-assigned this Feb 18, 2025
@erichaagdev erichaagdev changed the title Most logging is reduced to to info level Most logging is reduced to info level Feb 18, 2025
Copy link
Member

@bigdaz bigdaz left a comment

Choose a reason for hiding this comment

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

LGTM in general.

I wonder if there is a benefit to emitting a single log message at LIFECYCLE level when DV injection is applied and enabled? This message could even suggest running with --info for more details.

(I've not had the "pleasure" of configuring a DV injection on a real-world project, so I'm not sure how necessary/helpful the different log messages are)

@@ -93,7 +93,7 @@ if (!isTopLevelBuild) {
def requestedInitScriptName = getInputParam(gradle, 'develocity.injection.init-script-name')
def initScriptName = buildscript.sourceFile.name
if (requestedInitScriptName != initScriptName) {
logger.quiet("Ignoring init script '${initScriptName}' as requested name '${requestedInitScriptName}' does not match")
logger.info("Ignoring init script '${initScriptName}' as requested name '${requestedInitScriptName}' does not match")
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this should be a warning? Does it indicate some form of misconfiguration, or is there a legitimate use case where the init-script names wouldn't match?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, but it makes me wonder if it should only be a warning if develocity.injection-enabled=true, since we can assume the user's intention is to do auto-injection?

Copy link
Member

Choose a reason for hiding this comment

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

For sure, I had assumed that the check for develocity.injection-enabled would precede this check.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was addressed in b8bcfae

@bigdaz
Copy link
Member

bigdaz commented Feb 19, 2025

@erichaagdev I personally prefer this approach, but I have an uneasy feeling about how it's going to help in the real world. When enabling DV injection for a large number of projects, how useful are these log messages in troubleshooting, and how difficult will it be to enable them globally across a bunch of projects?

As an improvement we could leave these messages at 'info', but provide a mechanism to selectively bump them to 'lifecycle' via an environment variable. This would be a hybrid of this PR with your previous approach.

WDYT? It might be worth discussing within the solutions team to get real-world feedback. There's no mechanism to do cross-cutting DV injection with GitHub Actions, so my experience is biased.

@erichaagdev
Copy link
Member Author

As an improvement we could leave these messages at 'info', but provide a mechanism to selectively bump them to 'lifecycle' via an environment variable

@bigdaz if a user is wanting to set the log level for the injection script, I think it's safe to assume they either want injection logging on or off. At that point it makes more sense to me to just have a debug argument that either enables or disables injection logging, essentially what I had before.

how difficult will it be to enable them globally across a bunch of projects

I've had to debug CI injection before and we only used a single project to debug with. I don't see a good use case for needing to enable injection logging globally, but a debug argument could be applied to many projects if needed. The CI plugins could also add a checkbox to enable debug logging for the injection script. The BVS would use it too when --debug is used.

@bigdaz
Copy link
Member

bigdaz commented Feb 19, 2025

I think it could be beneficial to always emit the logging a info level. That way, an individual project can use --info to gain insight into what's going on with their build, including the DV injection side of things.

This is a different use case than someone configuring DV injection via CI for a set of projects. They may want to temporarily increase DV injection logging for debug purposes, but don't have the ability or desire to update the log level for each individual project.

By changing your original PR to default logging to INFO but upgrade logging to LIFECYCLE based on the presence of an env var, I think we satisfy both of these requirements. (I'd also be OK with the default being LIFECYCLE and having an env var to downgrade the level, which is even closer to your original solution)

@erichaagdev erichaagdev force-pushed the erichaagdev/reduce-logging branch 2 times, most recently from ae303aa to cf13f8a Compare February 20, 2025 18:59
The logging done by the init script is mainly used for testing
purposes and not needed by consumers.

In cases where this additional logging is needed, e.g., for debugging
injection in an environment, the property
`develocity.injection.debug=true` can be used to enable it.
@erichaagdev erichaagdev force-pushed the erichaagdev/reduce-logging branch from cf13f8a to b8bcfae Compare February 20, 2025 19:00
@erichaagdev erichaagdev changed the title Most logging is reduced to info level Most logging is reduced to info level by default Feb 20, 2025
@erichaagdev
Copy link
Member Author

@bigdaz this is ready for a re-review. I recommend looking at each commit in isolation:

  1. Reduce most logging to 'info' level by default f1d748d
  2. Emit at WARN level when init script name doesn't match b8bcfae

@erichaagdev erichaagdev requested a review from bigdaz February 20, 2025 19:03
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.

2 participants