-
Notifications
You must be signed in to change notification settings - Fork 49
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
Improve context in diagnostic logs #73
Conversation
@@ -72,13 +72,13 @@ public void execute(final Namespace ns, final DockerfileGitHubUtil dockerfileGit | |||
changeDockerfiles(ns, pathToDockerfilesInParentRepo, imagesFoundInParentRepo, imageToTagMap, currUserRepo, | |||
skippedRepos); | |||
} catch (IOException e) { | |||
log.error(String.format("Error changing Dockerfile for %s", currUserRepo.getName()), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems advantageous to go ahead and log this immediately to be able to envision flow a bit.
exceptions.add(e); | ||
} | ||
} | ||
|
||
if (!exceptions.isEmpty()) { | ||
log.info("There were {} errors with changing Dockerfiles.", exceptions.size()); | ||
throw exceptions.get(0); | ||
throw new IOException(String.format("There were %s errors with changing Dockerfiles.", exceptions.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not stuck on this approach but it seemed odd to log the message and then just throw the first exception.
@@ -142,7 +142,7 @@ protected void loadDockerfileGithubUtil(DockerfileGitHubUtil _dockerfileGitHubUt | |||
} | |||
} | |||
|
|||
log.info("Path to Dockerfiles in repo '{}': {}", parentRepoName, pathToDockerfilesInParentRepo); | |||
log.info("Path to Dockerfiles in repos: {}", pathToDockerfilesInParentRepo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parentRepoName
was the last repo (which doesn't really make sense when you're printing something for all of the repos.
@@ -167,7 +167,7 @@ public GHContent tryRetrievingContent(GHRepository repo, String path, String bra | |||
boolean listOfReposHasRecentForks = true; | |||
for (String s : pathToDockerfileInParentRepo.keySet()) { | |||
String forkName = s.substring(s.lastIndexOf('/') + 1); | |||
log.info(forkName); | |||
log.info(String.format("Verifying that %s has been forked", forkName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No context
b0aff97
to
21a902c
Compare
21a902c
to
0867228
Compare
@afalko any objections? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change!
Will add context for each change. Overall, there were some confusing strings and it seems useful to log some of these things near their locus of error.