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

feat: add logging at FINE level for each step of ADC #435

Merged
merged 3 commits into from Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -253,7 +253,7 @@ static boolean runningOnComputeEngine(
e);
}
}
LOGGER.log(Level.INFO, "Failed to detect whether we are running on Google Compute Engine.");
LOGGER.log(Level.FINE, "Failed to detect whether we are running on Google Compute Engine.");
return false;
}

Expand Down
Expand Up @@ -145,6 +145,7 @@ private final GoogleCredentials getDefaultCredentialsUnsynchronized(
GoogleCredentials credentials = null;
String credentialsPath = getEnv(CREDENTIAL_ENV_VAR);
if (credentialsPath != null && credentialsPath.length() > 0) {
LOGGER.log(Level.FINE, String.format("Loading credentials from file: %s", credentialsPath));
chingor13 marked this conversation as resolved.
Show resolved Hide resolved
InputStream credentialsStream = null;
try {
File credentialsFile = new File(credentialsPath);
Expand Down Expand Up @@ -178,6 +179,11 @@ private final GoogleCredentials getDefaultCredentialsUnsynchronized(
InputStream credentialsStream = null;
try {
if (isFile(wellKnownFileLocation)) {
LOGGER.log(
Level.FINE,
String.format(
"Loading credentials from well known file: %s",
chingor13 marked this conversation as resolved.
Show resolved Hide resolved
wellKnownFileLocation.getCanonicalPath()));
credentialsStream = readStream(wellKnownFileLocation);
credentials = GoogleCredentials.fromStream(credentialsStream, transportFactory);
}
Expand All @@ -198,17 +204,20 @@ private final GoogleCredentials getDefaultCredentialsUnsynchronized(

// Then try GAE 7 standard environment
if (credentials == null && isOnGAEStandard7() && !skipAppEngineCredentialsCheck()) {
LOGGER.log(Level.FINE, "Attempting to load credentials from GAE 7 Standard");
credentials = tryGetAppEngineCredential();
}

// Then try Cloud Shell. This must be done BEFORE checking
// Compute Engine, as Cloud Shell runs on GCE VMs.
if (credentials == null) {
LOGGER.log(Level.FINE, "Attempting to load credentials from Cloud Shell");
credentials = tryGetCloudShellCredentials();
}

// Then try Compute Engine and GAE 8 standard environment
if (credentials == null) {
LOGGER.log(Level.FINE, "Attempting to load credentials from GCE");
credentials = tryGetComputeCredentials(transportFactory);
}

Expand Down