Migrate to Flogger
Change-Id: I56fff7dcb7961b604851010450ce4583b0c09b23
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
index 5045613..3ce2a37 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
@@ -14,6 +14,7 @@
package com.googlesource.gerrit.plugins.task;
+import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.common.PluginDefinedInfo;
import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
@@ -32,11 +33,9 @@
import java.util.List;
import java.util.Map;
import org.eclipse.jgit.errors.ConfigInvalidException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class TaskAttributeFactory implements ChangeAttributeFactory {
- private static final Logger log = LoggerFactory.getLogger(TaskAttributeFactory.class);
+ private static final FluentLogger log = FluentLogger.forEnclosingClass();
public enum Status {
INVALID,
@@ -88,7 +87,7 @@
try {
return createWithExceptions(c);
} catch (OrmException e) {
- log.error("Cannot load tasks for: " + c, e);
+ log.atSevere().withCause(e).log("Cannot load tasks for: %s", c);
}
}
return null;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskConfigFactory.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskConfigFactory.java
index 418df6e..d5003b4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskConfigFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskConfigFactory.java
@@ -14,6 +14,7 @@
package com.googlesource.gerrit.plugins.task;
+import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Project;
@@ -30,11 +31,9 @@
import java.util.Map;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Repository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class TaskConfigFactory {
- private static final Logger log = LoggerFactory.getLogger(TaskConfigFactory.class);
+ private static final FluentLogger log = FluentLogger.forEnclosingClass();
protected static final String EXTENSION = ".config";
protected static final String DEFAULT = "task" + EXTENSION;
@@ -87,7 +86,7 @@
try (Repository git = gitMgr.openRepository(project)) {
cfg.load(project, git);
} catch (IOException e) {
- log.warn("Failed to load " + fileName + " for " + project.get(), e);
+ log.atWarning().withCause(e).log("Failed to load %s for %s", fileName, project);
throw e;
} catch (ConfigInvalidException e) {
throw e;