Migrate pgm classes to Flogger

This is the next part of the migration to Flogger. This change migrates
all classes of the 'pgm' module to Flogger. Classes of most other
modules have blready een migrated by predecessor changes. Some remaining
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: I51374131bbd97359ac4552df9878ff7f74c64e21
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-05-08 09:09:58 +02:00
parent 95bd9c2022
commit a8fec0e227
15 changed files with 88 additions and 80 deletions

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.pgm;
import static com.google.gerrit.pgm.init.InitPlugins.JAR;
import static com.google.gerrit.pgm.init.InitPlugins.PLUGIN_DIR;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.launcher.GerritLauncher;
import com.google.gerrit.pgm.init.PluginsDistribution;
import com.google.inject.Singleton;
@@ -28,12 +29,10 @@ import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Singleton
public class WarDistribution implements PluginsDistribution {
private static final Logger log = LoggerFactory.getLogger(WarDistribution.class);
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Override
public void foreach(Processor processor) throws IOException {
@@ -53,8 +52,7 @@ public class WarDistribution implements PluginsDistribution {
try (InputStream in = zf.getInputStream(ze)) {
processor.process(pluginName, in);
} catch (IOException ioe) {
log.error(
String.format("Error opening plugin %s: %s", ze.getName(), ioe.getMessage()));
logger.atSevere().log("Error opening plugin %s: %s", ze.getName(), ioe.getMessage());
}
}
}