Migrate server classes to Flogger
This is the second part of the migration to Flogger. This change migrates all classes of the 'server' module to Flogger. Classes of the 'httpd' module have been migrated by the predecessor change. Other modules continue to use slf4j. They should be migrated by follow-up changes. During this migration we try to make the log statements more consistent: - avoid string concatenation - avoid usage of String.format(...) Change-Id: I233afc8360af7fef8640394204d0d676cc0d0001 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -17,6 +17,7 @@ package com.google.gerrit.server.git;
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.extensions.events.GitReferenceUpdatedListener;
|
||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||
@@ -41,12 +42,11 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class SearchingChangeCacheImpl implements GitReferenceUpdatedListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(SearchingChangeCacheImpl.class);
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
static final String ID_CACHE = "changes";
|
||||
|
||||
public static class Module extends CacheModule {
|
||||
@@ -120,7 +120,7 @@ public class SearchingChangeCacheImpl implements GitReferenceUpdatedListener {
|
||||
}
|
||||
return Collections.unmodifiableList(cds);
|
||||
} catch (ExecutionException e) {
|
||||
log.warn("Cannot fetch changes for " + project, e);
|
||||
logger.atWarning().withCause(e).log("Cannot fetch changes for %s", project);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user