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:
Edwin Kempin
2018-05-04 11:50:06 +02:00
parent 03d2d209b1
commit a655fe03a7
195 changed files with 1513 additions and 1514 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.server.ssh;
import com.google.common.collect.Lists;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.util.SocketUtil;
import com.google.inject.AbstractModule;
@@ -26,11 +27,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jgit.lib.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SshAddressesModule extends AbstractModule {
private static final Logger log = LoggerFactory.getLogger(SshAddressesModule.class);
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
public static final int DEFAULT_PORT = 29418;
public static final int IANA_SSH_PORT = 22;
@@ -57,7 +56,7 @@ public class SshAddressesModule extends AbstractModule {
try {
listen.add(SocketUtil.resolve(desc, DEFAULT_PORT));
} catch (IllegalArgumentException e) {
log.error("Bad sshd.listenaddress: " + desc + ": " + e.getMessage());
logger.atSevere().log("Bad sshd.listenaddress: %s: %s", desc, e.getMessage());
}
}
return listen;