Migrate to internal FormattingLogger in GCP proxy in preparation of migration to Flogger

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197199265
This commit is contained in:
jianglai 2018-05-18 14:18:52 -07:00
parent 053c52e0bd
commit 68b24f0a54
14 changed files with 18 additions and 17 deletions

View file

@ -18,6 +18,7 @@ java_library(
"config/*.yaml",
]),
deps = [
"//java/com/google/common/logging:formatting_logger",
"//java/google/registry/config",
"//java/google/registry/util",
"@com_beust_jcommander",

View file

@ -19,11 +19,11 @@ 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;
import google.registry.proxy.ProxyConfig.Environment;
import google.registry.util.FormattingLogger;
import io.netty.handler.ssl.util.SelfSignedCertificate;
import java.io.ByteArrayInputStream;
import java.io.IOException;

View file

@ -17,6 +17,7 @@ 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;
@ -33,7 +34,6 @@ import google.registry.proxy.quota.QuotaConfig;
import google.registry.proxy.quota.QuotaManager;
import google.registry.proxy.quota.TokenStore;
import google.registry.util.Clock;
import google.registry.util.FormattingLogger;
import io.netty.channel.ChannelHandler;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;

View file

@ -19,6 +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.util.concurrent.ThreadFactoryBuilder;
import com.google.monitoring.metrics.MetricReporter;
import com.google.monitoring.metrics.MetricWriter;
@ -28,7 +29,6 @@ import dagger.Module;
import dagger.Provides;
import google.registry.proxy.ProxyConfig.Environment;
import google.registry.proxy.metric.MetricParameters;
import google.registry.util.FormattingLogger;
import javax.inject.Singleton;
/** Module that provides necessary bindings to instantiate a {@link MetricReporter} */

View file

@ -28,6 +28,7 @@ import com.google.api.services.cloudkms.v1.model.DecryptRequest;
import com.google.api.services.storage.Storage;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.common.logging.FormattingLogger;
import com.google.monitoring.metrics.MetricReporter;
import dagger.Component;
import dagger.Module;
@ -38,7 +39,6 @@ import google.registry.proxy.Protocol.FrontendProtocol;
import google.registry.proxy.ProxyConfig.Environment;
import google.registry.proxy.WhoisProtocolModule.WhoisProtocol;
import google.registry.util.Clock;
import google.registry.util.FormattingLogger;
import google.registry.util.SystemClock;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

View file

@ -20,11 +20,11 @@ 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;
import google.registry.proxy.ProxyModule.ProxyComponent;
import google.registry.util.FormattingLogger;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;

View file

@ -20,8 +20,8 @@ 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 google.registry.proxy.metric.FrontendMetrics;
import google.registry.util.FormattingLogger;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;

View file

@ -17,8 +17,8 @@ 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 google.registry.proxy.metric.FrontendMetrics;
import google.registry.util.FormattingLogger;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;

View file

@ -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 google.registry.util.FormattingLogger;
import com.google.common.logging.FormattingLogger;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

View file

@ -16,7 +16,7 @@ package google.registry.proxy.handler;
import static com.google.common.base.Preconditions.checkNotNull;
import google.registry.util.FormattingLogger;
import com.google.common.logging.FormattingLogger;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
@ -47,7 +47,7 @@ public class RelayHandler<I> extends SimpleChannelInboundHandler<I> {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.severefmt(cause, "Inbound exception caught for channel %s", ctx.channel());
ctx.close();
ChannelFuture unusedFuture = ctx.close();
}
/** Close relay channel if this channel is closed. */
@ -55,7 +55,7 @@ public class RelayHandler<I> extends SimpleChannelInboundHandler<I> {
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
Channel relayChannel = ctx.channel().attr(RELAY_CHANNEL_KEY).get();
if (relayChannel != null) {
relayChannel.close();
ChannelFuture unusedFuture = relayChannel.close();
}
ctx.fireChannelInactive();
}
@ -72,12 +72,12 @@ public class RelayHandler<I> extends SimpleChannelInboundHandler<I> {
future -> {
// Cannot write into relay channel, close this channel.
if (!future.isSuccess()) {
ctx.close();
ChannelFuture unusedFuture = ctx.close();
}
});
} else {
// close this channel if the relay channel is closed.
ctx.close();
ChannelFuture unusedFuture = ctx.close();
}
}

View file

@ -17,9 +17,9 @@ 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 google.registry.proxy.HttpsRelayProtocolModule.HttpsRelayProtocol;
import google.registry.proxy.Protocol.BackendProtocol;
import google.registry.util.FormattingLogger;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelInitializer;

View file

@ -14,8 +14,8 @@
package google.registry.proxy.handler;
import com.google.common.logging.FormattingLogger;
import google.registry.proxy.CertificateModule.EppCertificates;
import google.registry.util.FormattingLogger;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelInitializer;

View file

@ -19,7 +19,7 @@ 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.io.CharStreams;
import google.registry.util.FormattingLogger;
import com.google.common.logging.FormattingLogger;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

View file

@ -20,8 +20,8 @@ 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 google.registry.util.Clock;
import google.registry.util.FormattingLogger;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;