From 05f166918f938c6dc1fb6cd945356a06f8c308a6 Mon Sep 17 00:00:00 2001 From: jianglai Date: Mon, 21 May 2018 15:08:53 -0700 Subject: [PATCH] Migrating to fluent logging (green) This is a 'green' Flogger migration CL. Green CLs are intended to be as safe as possible and should be easy to review and submit. No changes should be necessary to the code itself prior to submission, but small changes to BUILD files may be required. Changes within files are completely independent of each other, so this CL can be safely split up for review using tools such as Rosie. For more information, see [] Base CL: 197331037 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=197466715 --- .../registry/proxy/CertificateModule.java | 14 +++--- .../registry/proxy/EppProtocolModule.java | 6 +-- java/google/registry/proxy/MetricsModule.java | 6 +-- java/google/registry/proxy/ProxyServer.java | 43 ++++++++----------- .../proxy/handler/EppServiceHandler.java | 6 +-- .../handler/HttpsRelayServiceHandler.java | 13 +++--- .../proxy/handler/ProxyProtocolHandler.java | 16 +++---- .../registry/proxy/handler/RelayHandler.java | 7 +-- .../proxy/handler/SslClientInitializer.java | 6 +-- .../proxy/handler/SslServerInitializer.java | 6 +-- .../proxy/metric/MetricParameters.java | 13 +++--- .../registry/proxy/quota/TokenStore.java | 6 +-- 12 files changed, 64 insertions(+), 78 deletions(-) diff --git a/java/google/registry/proxy/CertificateModule.java b/java/google/registry/proxy/CertificateModule.java index b5b69a2ad..d5f712818 100644 --- a/java/google/registry/proxy/CertificateModule.java +++ b/java/google/registry/proxy/CertificateModule.java @@ -19,7 +19,6 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableList; -import com.google.common.logging.FormattingLogger; import dagger.Lazy; import dagger.Module; import dagger.Provides; @@ -73,8 +72,6 @@ public class CertificateModule { @Qualifier public @interface Prod {} - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); - static { Security.addProvider(new BouncyCastleProvider()); } @@ -159,8 +156,7 @@ public class CertificateModule { listBuilder.add(obj); } } catch (IOException e) { - logger.severe(e, "Cannot parse PEM file correctly."); - throw new RuntimeException(e); + throw new RuntimeException("Cannot parse PEM file correctly.", e); } } return listBuilder.build(); @@ -176,8 +172,8 @@ public class CertificateModule { try { return converter.getKeyPair(pemKeyPair).getPrivate(); } catch (PEMException e) { - logger.severefmt(e, "Error converting private key: %s", pemKeyPair); - throw new RuntimeException(e); + throw new RuntimeException( + String.format("Error converting private key: %s", pemKeyPair), e); } }; ImmutableList privateKeys = @@ -200,8 +196,8 @@ public class CertificateModule { try { return converter.getCertificate(certificateHolder); } catch (CertificateException e) { - logger.severefmt(e, "Error converting certificate: %s", certificateHolder); - throw new RuntimeException(e); + throw new RuntimeException( + String.format("Error converting certificate: %s", certificateHolder), e); } }; ImmutableList certificates = diff --git a/java/google/registry/proxy/EppProtocolModule.java b/java/google/registry/proxy/EppProtocolModule.java index c454f0342..fa82703dc 100644 --- a/java/google/registry/proxy/EppProtocolModule.java +++ b/java/google/registry/proxy/EppProtocolModule.java @@ -17,7 +17,6 @@ package google.registry.proxy; import static google.registry.util.ResourceUtils.readResourceBytes; import com.google.common.collect.ImmutableList; -import com.google.common.logging.FormattingLogger; import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoSet; @@ -52,8 +51,6 @@ import javax.inject.Singleton; @Module public class EppProtocolModule { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); - /** Dagger qualifier to provide epp protocol related handlers and other bindings. */ @Qualifier public @interface EppProtocol {} @@ -136,8 +133,7 @@ public class EppProtocolModule { try { return readResourceBytes(EppProtocolModule.class, "resources/hello.xml").read(); } catch (IOException e) { - logger.severe(e, "Cannot read EPP message file."); - throw new RuntimeException(e); + throw new RuntimeException("Cannot read EPP message file.", e); } } diff --git a/java/google/registry/proxy/MetricsModule.java b/java/google/registry/proxy/MetricsModule.java index c128be1f7..db8fb7094 100644 --- a/java/google/registry/proxy/MetricsModule.java +++ b/java/google/registry/proxy/MetricsModule.java @@ -19,7 +19,7 @@ import com.google.api.client.googleapis.util.Utils; import com.google.api.services.monitoring.v3.Monitoring; import com.google.api.services.monitoring.v3.model.MonitoredResource; import com.google.common.collect.ImmutableMap; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.monitoring.metrics.MetricReporter; import com.google.monitoring.metrics.MetricWriter; @@ -35,7 +35,7 @@ import javax.inject.Singleton; @Module public class MetricsModule { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); @Singleton @Provides @@ -89,7 +89,7 @@ public class MetricsModule { } else { monitoredResource.setType("gke_container").setLabels(metricParameters.makeLabelsMap()); } - logger.infofmt("Monitored resource: %s", monitoredResource); + logger.atInfo().log("Monitored resource: %s", monitoredResource); return monitoredResource; } diff --git a/java/google/registry/proxy/ProxyServer.java b/java/google/registry/proxy/ProxyServer.java index a7f4dcf6b..78ba40f90 100644 --- a/java/google/registry/proxy/ProxyServer.java +++ b/java/google/registry/proxy/ProxyServer.java @@ -20,7 +20,6 @@ import static google.registry.proxy.handler.RelayHandler.RELAY_CHANNEL_KEY; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.flogger.FluentLogger; -import com.google.common.logging.FormattingLogger; import com.google.monitoring.metrics.MetricReporter; import google.registry.proxy.Protocol.BackendProtocol; import google.registry.proxy.Protocol.FrontendProtocol; @@ -51,9 +50,7 @@ import javax.inject.Provider; */ public class ProxyServer implements Runnable { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); - // TODO (b/78466557): remove dummy flogger. - private static final FluentLogger flogger = FluentLogger.forEnclosingClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); /** Maximum length of the queue of incoming connections. */ private static final int MAX_SOCKET_BACKLOG = 128; @@ -127,18 +124,16 @@ public class ProxyServer implements Runnable { // Outbound channel established successfully, inbound channel can start reading. // This setter also calls channel.read() to request read operation. inboundChannel.config().setAutoRead(true); - logger.infofmt( + logger.atInfo().log( "Relay established: %s <-> %s\nSERVER: %s\nCLIENT: %s", inboundProtocol.name(), outboundProtocol.name(), inboundChannel, outboundChannel); } else { - logger.severefmt( - future.cause(), + logger.atSevere().withCause(future.cause()).log( "Cannot connect to relay channel for %s protocol connection from %s.", - inboundProtocol.name(), - inboundChannel.remoteAddress().getHostName()); + inboundProtocol.name(), inboundChannel.remoteAddress().getHostName()); } }); } @@ -173,15 +168,15 @@ public class ProxyServer implements Runnable { // Wait for binding to be established for each listening port. ChannelFuture serverChannelFuture = serverBootstrap.bind(port).sync(); if (serverChannelFuture.isSuccess()) { - flogger.atInfo().log( + logger.atInfo().log( "Start listening on port %s for %s protocol.", port, protocol.name()); Channel serverChannel = serverChannelFuture.channel(); serverChannel.attr(PROTOCOL_KEY).set(protocol); portToChannelMap.put(port, serverChannel); } } catch (InterruptedException e) { - logger.severefmt( - e, "Cannot listen on port %s for %s protocol.", port, protocol.name()); + logger.atSevere().withCause(e).log( + "Cannot listen on port %d for %s protocol.", port, protocol.name()); } }); @@ -191,19 +186,17 @@ public class ProxyServer implements Runnable { try { // Block until all server channels are closed. ChannelFuture unusedFuture = channel.closeFuture().sync(); - logger.infofmt( - "Stop listening on port %s for %s protocol.", + logger.atInfo().log( + "Stop listening on port %d for %s protocol.", port, channel.attr(PROTOCOL_KEY).get().name()); } catch (InterruptedException e) { - logger.severefmt( - e, - "Listening on port %s for %s protocol interrupted.", - port, - channel.attr(PROTOCOL_KEY).get().name()); + logger.atSevere().withCause(e).log( + "Listening on port %d for %s protocol interrupted.", + port, channel.attr(PROTOCOL_KEY).get().name()); } }); } finally { - logger.info("Shutting down server..."); + logger.atInfo().log("Shutting down server..."); Future unusedFuture = eventGroup.shutdownGracefully(); } } @@ -223,9 +216,10 @@ public class ProxyServer implements Runnable { MetricReporter metricReporter = proxyComponent.metricReporter(); try { metricReporter.startAsync().awaitRunning(10, TimeUnit.SECONDS); - logger.info("Started up MetricReporter"); + logger.atInfo().log("Started up MetricReporter"); } catch (TimeoutException timeoutException) { - logger.severefmt("Failed to initialize MetricReporter: %s", timeoutException); + logger.atSevere().withCause(timeoutException).log( + "Failed to initialize MetricReporter: %s", timeoutException); } Runtime.getRuntime() @@ -234,9 +228,10 @@ public class ProxyServer implements Runnable { () -> { try { metricReporter.stopAsync().awaitTerminated(10, TimeUnit.SECONDS); - logger.info("Shut down MetricReporter"); + logger.atInfo().log("Shut down MetricReporter"); } catch (TimeoutException timeoutException) { - logger.warningfmt("Failed to stop MetricReporter: %s", timeoutException); + logger.atWarning().withCause(timeoutException).log( + "Failed to stop MetricReporter: %s", timeoutException); } })); diff --git a/java/google/registry/proxy/handler/EppServiceHandler.java b/java/google/registry/proxy/handler/EppServiceHandler.java index f64cd82a2..10318cfd8 100644 --- a/java/google/registry/proxy/handler/EppServiceHandler.java +++ b/java/google/registry/proxy/handler/EppServiceHandler.java @@ -20,7 +20,7 @@ import static google.registry.proxy.handler.ProxyProtocolHandler.REMOTE_ADDRESS_ import static google.registry.proxy.handler.SslServerInitializer.CLIENT_CERTIFICATE_PROMISE_KEY; import static google.registry.util.X509Utils.getCertificateHash; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import google.registry.proxy.metric.FrontendMetrics; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -40,7 +40,7 @@ import java.util.function.Supplier; /** Handler that processes EPP protocol logic. */ public class EppServiceHandler extends HttpsRelayServiceHandler { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); /** * Attribute key to the client certificate hash whose value is set when the certificate promise is @@ -118,7 +118,7 @@ public class EppServiceHandler extends HttpsRelayServiceHandler { "epp", sslClientCertificateHash, ctx.channel()); channelRead(ctx, Unpooled.wrappedBuffer(helloBytes)); } else { - logger.severefmt(promise.cause(), "Cannot finish handshake."); + logger.atSevere().withCause(promise.cause()).log("Cannot finish handshake."); ChannelFuture unusedFuture = ctx.close(); } }); diff --git a/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java b/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java index 6104d5688..4dfe8dc0a 100644 --- a/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java +++ b/java/google/registry/proxy/handler/HttpsRelayServiceHandler.java @@ -17,7 +17,7 @@ package google.registry.proxy.handler; import static com.google.common.base.Preconditions.checkArgument; import static java.nio.charset.StandardCharsets.UTF_8; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import google.registry.proxy.metric.FrontendMetrics; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelFuture; @@ -57,7 +57,7 @@ import java.util.function.Supplier; */ abstract class HttpsRelayServiceHandler extends ByteToMessageCodec { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private final Map cookieStore = new LinkedHashMap<>(); private final String relayHost; @@ -162,7 +162,8 @@ abstract class HttpsRelayServiceHandler extends ByteToMessageCodec { if (!channelFuture.isSuccess()) { - logger.severefmt( - channelFuture.cause(), - "Outbound exception caught for channel %s", - channelFuture.channel()); + logger.atSevere().withCause(channelFuture.cause()).log( + "Outbound exception caught for channel %s", channelFuture.channel()); ChannelFuture unusedFuture = channelFuture.channel().close(); } }); diff --git a/java/google/registry/proxy/handler/ProxyProtocolHandler.java b/java/google/registry/proxy/handler/ProxyProtocolHandler.java index e0bfd609e..0a6faada1 100644 --- a/java/google/registry/proxy/handler/ProxyProtocolHandler.java +++ b/java/google/registry/proxy/handler/ProxyProtocolHandler.java @@ -17,7 +17,7 @@ package google.registry.proxy.handler; import static com.google.common.base.Preconditions.checkState; import static java.nio.charset.StandardCharsets.US_ASCII; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; @@ -56,7 +56,7 @@ public class ProxyProtocolHandler extends ByteToMessageDecoder { public static final AttributeKey REMOTE_ADDRESS_KEY = AttributeKey.valueOf("REMOTE_ADDRESS_KEY"); - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); // The proxy header must start with this prefix. // Sample header: "PROXY TCP4 255.255.255.255 255.255.255.255 65535 65535\r\n". @@ -74,24 +74,24 @@ public class ProxyProtocolHandler extends ByteToMessageDecoder { if (finished) { String remoteIP; if (proxyHeader != null) { - logger.finefmt("PROXIED CONNECTION: %s", ctx.channel()); - logger.finefmt("PROXY HEADER: %s", proxyHeader); + logger.atFine().log("PROXIED CONNECTION: %s", ctx.channel()); + logger.atFine().log("PROXY HEADER: %s", proxyHeader); String[] headerArray = proxyHeader.split(" ", -1); if (headerArray.length == 6) { remoteIP = headerArray[2]; - logger.finefmt("Header parsed, using %s as remote IP.", remoteIP); + logger.atFine().log("Header parsed, using %s as remote IP.", remoteIP); } else { - logger.finefmt("Cannot parse the header, use source IP as a last resort."); + logger.atFine().log("Cannot parse the header, use source IP as a last resort."); remoteIP = getSourceIP(ctx); } } else { - logger.finefmt("No header present, using source IP directly."); + logger.atFine().log("No header present, using source IP directly."); remoteIP = getSourceIP(ctx); } if (remoteIP != null) { ctx.channel().attr(REMOTE_ADDRESS_KEY).set(remoteIP); } else { - logger.warningfmt("Not able to obtain remote IP for %s", ctx.channel()); + logger.atWarning().log("Not able to obtain remote IP for %s", ctx.channel()); } // ByteToMessageDecoder automatically flushes unread bytes in the ByteBuf to the next handler // when itself is being removed. diff --git a/java/google/registry/proxy/handler/RelayHandler.java b/java/google/registry/proxy/handler/RelayHandler.java index 33557c4a1..2193b348d 100644 --- a/java/google/registry/proxy/handler/RelayHandler.java +++ b/java/google/registry/proxy/handler/RelayHandler.java @@ -16,7 +16,7 @@ package google.registry.proxy.handler; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; @@ -33,7 +33,7 @@ import javax.inject.Inject; */ public class RelayHandler extends SimpleChannelInboundHandler { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); /** Key used to retrieve the relay channel from a {@link Channel}'s {@link Attribute}. */ public static final AttributeKey RELAY_CHANNEL_KEY = @@ -46,7 +46,8 @@ public class RelayHandler extends SimpleChannelInboundHandler { /** Terminate connection when an exception is caught during inbound IO. */ @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - logger.severefmt(cause, "Inbound exception caught for channel %s", ctx.channel()); + logger.atSevere().withCause(cause).log( + "Inbound exception caught for channel %s", ctx.channel()); ChannelFuture unusedFuture = ctx.close(); } diff --git a/java/google/registry/proxy/handler/SslClientInitializer.java b/java/google/registry/proxy/handler/SslClientInitializer.java index 9b96d158d..24282ba8b 100644 --- a/java/google/registry/proxy/handler/SslClientInitializer.java +++ b/java/google/registry/proxy/handler/SslClientInitializer.java @@ -17,7 +17,7 @@ package google.registry.proxy.handler; import static com.google.common.base.Preconditions.checkNotNull; import static google.registry.proxy.Protocol.PROTOCOL_KEY; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import google.registry.proxy.HttpsRelayProtocolModule.HttpsRelayProtocol; import google.registry.proxy.Protocol.BackendProtocol; import io.netty.channel.Channel; @@ -45,14 +45,14 @@ import javax.net.ssl.SSLParameters; @Sharable public class SslClientInitializer extends ChannelInitializer { - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private final SslProvider sslProvider; private final X509Certificate[] trustedCertificates; @Inject SslClientInitializer( SslProvider sslProvider, @Nullable @HttpsRelayProtocol X509Certificate... trustCertificates) { - logger.infofmt("Client SSL Provider: %s", sslProvider); + logger.atInfo().log("Client SSL Provider: %s", sslProvider); this.sslProvider = sslProvider; this.trustedCertificates = trustCertificates; } diff --git a/java/google/registry/proxy/handler/SslServerInitializer.java b/java/google/registry/proxy/handler/SslServerInitializer.java index b4e1aa178..858585a18 100644 --- a/java/google/registry/proxy/handler/SslServerInitializer.java +++ b/java/google/registry/proxy/handler/SslServerInitializer.java @@ -14,7 +14,7 @@ package google.registry.proxy.handler; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import google.registry.proxy.CertificateModule.EppCertificates; import io.netty.channel.Channel; import io.netty.channel.ChannelHandler.Sharable; @@ -58,7 +58,7 @@ public class SslServerInitializer extends ChannelInitializer< public static final AttributeKey> CLIENT_CERTIFICATE_PROMISE_KEY = AttributeKey.valueOf("CLIENT_CERTIFICATE_PROMISE_KEY"); - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private final SslProvider sslProvider; private final PrivateKey privateKey; private final X509Certificate[] certificates; @@ -68,7 +68,7 @@ public class SslServerInitializer extends ChannelInitializer< SslProvider sslProvider, @EppCertificates PrivateKey privateKey, @EppCertificates X509Certificate... certificates) { - logger.infofmt("Server SSL Provider: %s", sslProvider); + logger.atInfo().log("Server SSL Provider: %s", sslProvider); this.sslProvider = sslProvider; this.privateKey = privateKey; this.certificates = certificates; diff --git a/java/google/registry/proxy/metric/MetricParameters.java b/java/google/registry/proxy/metric/MetricParameters.java index 64abb6f68..4cdd80155 100644 --- a/java/google/registry/proxy/metric/MetricParameters.java +++ b/java/google/registry/proxy/metric/MetricParameters.java @@ -18,8 +18,8 @@ import static java.nio.charset.StandardCharsets.UTF_8; import com.google.api.services.monitoring.v3.model.MonitoredResource; import com.google.common.collect.ImmutableMap; +import com.google.common.flogger.FluentLogger; import com.google.common.io.CharStreams; -import com.google.common.logging.FormattingLogger; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; @@ -62,7 +62,7 @@ public class MetricParameters { static final String INSTANCE_ID_PATH = "computeMetadata/v1/instance/id"; static final String ZONE_PATH = "computeMetadata/v1/instance/zone"; - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private final Map envVarMap; private final Function connectionFactory; @@ -88,8 +88,7 @@ public class MetricParameters { connection.setDoOutput(true); return connection; } catch (IOException e) { - logger.warningfmt(e, "Incorrect GCE metadata server URL: %s", url); - throw new RuntimeException(e); + throw new RuntimeException(String.format("Incorrect GCE metadata server URL: %s", url), e); } } @@ -104,7 +103,7 @@ public class MetricParameters { connection.connect(); int responseCode = connection.getResponseCode(); if (responseCode < 200 || responseCode > 299) { - logger.warningfmt( + logger.atWarning().log( "Got an error response: %d\n%s", responseCode, CharStreams.toString(new InputStreamReader(connection.getErrorStream(), UTF_8))); @@ -112,7 +111,7 @@ public class MetricParameters { value = CharStreams.toString(new InputStreamReader(connection.getInputStream(), UTF_8)); } } catch (IOException e) { - logger.warningfmt(e, "Cannot obtain GCE metadata from path %s", path); + logger.atWarning().withCause(e).log("Cannot obtain GCE metadata from path %s", path); } return value; } @@ -124,7 +123,7 @@ public class MetricParameters { String zone; String[] fullZoneArray = fullZone.split("/", -1); if (fullZoneArray.length < 4) { - logger.warningfmt("Zone %s is valid.", fullZone); + logger.atWarning().log("Zone %s is valid.", fullZone); // This will make the metric report throw, but it happens in a different thread and will not // kill the whole application. zone = ""; diff --git a/java/google/registry/proxy/quota/TokenStore.java b/java/google/registry/proxy/quota/TokenStore.java index 5cf7433fe..6737288f2 100644 --- a/java/google/registry/proxy/quota/TokenStore.java +++ b/java/google/registry/proxy/quota/TokenStore.java @@ -20,7 +20,7 @@ import static java.lang.StrictMath.min; import com.google.auto.value.AutoValue; import com.google.common.annotations.VisibleForTesting; -import com.google.common.logging.FormattingLogger; +import com.google.common.flogger.FluentLogger; import google.registry.util.Clock; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Future; @@ -70,7 +70,7 @@ public class TokenStore { T value; } - private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); /** A map of {@code userId} to available tokens, timestamped at last refill time. */ private final ConcurrentHashMap tokensMap = new ConcurrentHashMap<>(); @@ -201,7 +201,7 @@ public class TokenStore { refreshExecutor.scheduleWithFixedDelay( () -> { refresh(); - logger.infofmt("Refreshing quota for protocol %s", config.getProtocolName()); + logger.atInfo().log("Refreshing quota for protocol %s", config.getProtocolName()); }, config.getRefreshPeriod().getStandardSeconds(), config.getRefreshPeriod().getStandardSeconds(),