Migrate all remaining classes to Flogger
This is the next part of the migration to Flogger. This change migrates all remaining classes Flogger. This means all classes in Gerrit core now use Flogger. During this migration we try to make the log statements more consistent: - avoid string concatenation - avoid usage of String.format(...) The visibility of the slf4j library is restricted to plugins and jgit now. This avoids that we accidentally add new dependencies to slf4j. Change-Id: Ide573327315a15cde69b68b5f27934deeb790d37 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -8,8 +8,8 @@ java_library(
|
||||
"//java/com/google/gerrit/lifecycle",
|
||||
"//java/org/eclipse/jgit:server",
|
||||
"//lib:guava",
|
||||
"//lib/flogger:api",
|
||||
"//lib/guice",
|
||||
"//lib/jgit/org.eclipse.jgit:jgit",
|
||||
"//lib/log:api",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
|
||||
package com.google.gerrit.metrics.proc;
|
||||
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.OperatingSystemMXBean;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
class OperatingSystemMXBeanProvider {
|
||||
private static final Logger log = LoggerFactory.getLogger(OperatingSystemMXBeanProvider.class);
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final OperatingSystemMXBean sys;
|
||||
private final Method getProcessCpuTime;
|
||||
@@ -41,10 +40,10 @@ class OperatingSystemMXBeanProvider {
|
||||
return new OperatingSystemMXBeanProvider(sys);
|
||||
}
|
||||
} catch (ReflectiveOperationException e) {
|
||||
log.debug("No implementation for {}", name, e);
|
||||
logger.atFine().withCause(e).log("No implementation for %s", name);
|
||||
}
|
||||
}
|
||||
log.warn("No implementation of UnixOperatingSystemMXBean found");
|
||||
logger.atWarning().log("No implementation of UnixOperatingSystemMXBean found");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user