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

Option to enable/disable injection logging is added #38

Closed
wants to merge 1 commit into from

Conversation

erichaagdev
Copy link
Member

Adds the property develocity.injection.logging-enabled to enable or disable all log output from the injection script. Logging is enabled by default if not specified.

This provides a mechanism for consumers to disable only injection logging without affecting the rest of the logging done by the build.

For maintainers, this requires all current and future logging to be done through the new log(Gradle, Logger, LogLevel, String) function.

@erichaagdev erichaagdev requested review from bigdaz and a team February 10, 2025 17:10
@erichaagdev erichaagdev self-assigned this Feb 10, 2025
@erichaagdev erichaagdev force-pushed the erichaagdev/logging-enabled-option branch from 422b998 to 7ba1291 Compare February 10, 2025 17:16
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved all the outputMisses.../outputContains... checks and DvInjectionTestConfig helper class to the base init script so all test classes that subclass this class can access them. Some of are only related to injection, so you might consider this a code smell. However, I would also consider statically referencing one of these functions from TestBuildScanCapture to also be a code smell.

def config = TestDevelocityInjection.createTestConfig(mockScansServer.address, testDvPlugin.version)

I saw this as the simplest solution to share these checks that didn't require splitting the checks up or duplicating them. I'm open to other ideas.

Adds the property `develocity.injection.logging-enabled` to enable or
disable all log output from the injection script. Logging is enabled by
default if not specified.

For maintainers, this requires all current and future logging to be done
 through the new `log(Gradle, Logger, LogLevel, String)` function.
@erichaagdev erichaagdev force-pushed the erichaagdev/logging-enabled-option branch from 7ba1291 to 6de157a Compare February 10, 2025 17:31
@bigdaz
Copy link
Member

bigdaz commented Feb 17, 2025

@erichaagdev I agree with the idea of making the injection script less "noisy", but what was the trigger to make this change now? What clients are expected to disable logging?

I wonder if it wouldn't be better to just make the logging less intrusive in general:

  • By default, log at INFO level instead of LIFECYCLE or QUIET.
  • Leave the current WARNING log message, since this indicates a misconfiguration.
  • In testing, run builds with --info to ensure we can pick up the required log messages.

I would prefer to avoid adding a new flag to specifically disable injection logging, unless we really need it.

@erichaagdev
Copy link
Member Author

@bigdaz My apologies for not including this in the original description. My intention for this was to be used primarily for the BVS where the user is usually running these from the terminal and the additional messages cause some (minor) noise. In most cases, like the CI plugins, this isn't really an issue.

image

I'm fine going with the approach you suggested. The reason I went this path was so the logging could be enabled by default and not impact the CI plugins, for which this additional logging could be useful.

@bigdaz
Copy link
Member

bigdaz commented Feb 18, 2025

I'm not sure the additional logging is all that useful for CI integrations. The messages may be helpful during initial setup and when debugging issues, but I don't feel that they add any value during "normal" operation.

If possible, I will likely suppress the log messages by default for setup-gradle.

@erichaagdev
Copy link
Member Author

Sounds good. In that case, I'll close this PR and create a new one since there will be little reuse of what I have here to implement your suggestion.

@erichaagdev erichaagdev deleted the erichaagdev/logging-enabled-option branch February 18, 2025 21:06
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