Remove unneeded submodule submit logs that spam the error log
For projects that use submodules extensively we create lots of unneeded logs during submit (if log level is DEBUG or if the request is traced). GitModule#subscribedTo(Branch.NameKey) was logging 1. the branch name for which submodule subscriptions are checked 2. the found subscriptions SubmoduleOp#superProjectSubscriptionsForSubmoduleBranch(Branch.NameKey) is the only caller of GitModule#subscribedTo(Branch.NameKey) and it already logs the branch name that is passed into GitModule#subscribedTo(Branch.NameKey) and the results that it gets back so that logs in GitModule#subscribedTo(Branch.NameKey) are unneeded and can be removed without losing information. SubmoduleOp#superProjectSubscriptionsForSubmoduleBranch(Branch.NameKey) logs all results from GitModule#subscribedTo(Branch.NameKey) with a single log entry. This is much less noisy then logging each result separately as it was done by GitModule#subscribedTo(Branch.NameKey). In addition make GitModule#subscribedTo(Branch.NameKey) package-private since it's not used outside of the package. Also make the subscriptions field in GitModules private since it's only used within this class. Change-Id: I28cabdca650368348bb44c04699592a9ede8478e Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -50,8 +50,7 @@ public class GitModules {
|
||||
|
||||
private static final String GIT_MODULES = ".gitmodules";
|
||||
|
||||
private final Branch.NameKey branch;
|
||||
Set<SubmoduleSubscription> subscriptions;
|
||||
private Set<SubmoduleSubscription> subscriptions;
|
||||
|
||||
@Inject
|
||||
GitModules(
|
||||
@@ -59,7 +58,6 @@ public class GitModules {
|
||||
@Assisted Branch.NameKey branch,
|
||||
@Assisted MergeOpRepoManager orm)
|
||||
throws IOException {
|
||||
this.branch = branch;
|
||||
Project.NameKey project = branch.getParentKey();
|
||||
logger.atFine().log("Loading .gitmodules of %s for project %s", branch, project);
|
||||
try {
|
||||
@@ -91,12 +89,10 @@ public class GitModules {
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<SubmoduleSubscription> subscribedTo(Branch.NameKey src) {
|
||||
logger.atFine().log("Checking for a subscription of %s for %s", src, branch);
|
||||
Collection<SubmoduleSubscription> subscribedTo(Branch.NameKey src) {
|
||||
Collection<SubmoduleSubscription> ret = new ArrayList<>();
|
||||
for (SubmoduleSubscription s : subscriptions) {
|
||||
if (s.getSubmodule().equals(src)) {
|
||||
logger.atFine().log("Found %s", s);
|
||||
ret.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user