From 9eb824241016d4a0053a0d5e91eb27973e48add5 Mon Sep 17 00:00:00 2001 From: daz Date: Sun, 11 Feb 2024 17:11:35 -0700 Subject: [PATCH] Improvements to debug logging - Enable cache debugging when ACTIONS_STEP_DEBUG is on - Replace some info messages with debug --- setup-gradle/README.md | 2 +- sources/src/cache-base.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup-gradle/README.md b/setup-gradle/README.md index ae59f33..e6871e3 100644 --- a/setup-gradle/README.md +++ b/setup-gradle/README.md @@ -215,7 +215,7 @@ env: GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true ``` -Note that this setting will also prevent certain cache operations from running in parallel, further assisting with debugging. +Note that when the workflow is run in debug mode (above), cache debugging is automatically enabled. ## How Gradle User Home caching works diff --git a/sources/src/cache-base.ts b/sources/src/cache-base.ts index 5aad7a2..4a7905c 100644 --- a/sources/src/cache-base.ts +++ b/sources/src/cache-base.ts @@ -247,6 +247,8 @@ export class GradleStateCache { /** * When the GitHub environment ACTIONS_RUNNER_DEBUG is true, run Gradle with --info and --stacktrace. * see https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging + * + * @VisibleForTesting */ configureInfoLogLevel(): void { const infoProperties = `org.gradle.logging.level=info\norg.gradle.logging.stacktrace=all\n` @@ -262,11 +264,11 @@ export class GradleStateCache { } /** - * When cache debugging is enabled, this method will give a detailed report - * of the Gradle User Home contents. + * When cache debugging is enabled (or ACTIONS_STEP_DEBUG is on), + * this method will give a detailed report of the Gradle User Home contents. */ private async debugReportGradleUserHomeSize(label: string): Promise { - if (!isCacheDebuggingEnabled()) { + if (!isCacheDebuggingEnabled() && !core.isDebug()) { return } if (!fs.existsSync(this.gradleUserHome)) {