Migrate httpd classes to Flogger

This is the first part of the migration to Flogger. This change
migrates all classes of the 'http' module to Flogger. 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: I473c41733b00aa1ceab92fe0dc8cd1c6b347174c
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-04-30 16:29:35 +02:00
parent 2b81d71374
commit 03d2d209b1
32 changed files with 245 additions and 268 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.httpd.plugins;
import com.google.common.collect.Maps;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Version;
import com.google.gerrit.server.plugins.Plugin;
import java.io.InputStream;
@@ -29,11 +30,9 @@ import java.util.concurrent.ConcurrentMap;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class PluginServletContext {
private static final Logger log = LoggerFactory.getLogger(PluginServletContext.class);
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
static ServletContext create(Plugin plugin, String contextPath) {
return (ServletContext)
@@ -155,7 +154,7 @@ class PluginServletContext {
@Override
public void log(String msg, Throwable reason) {
log.warn("[plugin {}] {}", plugin.getName(), msg, reason);
logger.atWarning().withCause(reason).log("[plugin %s] %s", plugin.getName(), msg);
}
@Override