Java Code Examples for io.netty.handler.logging.LogLevel#DEBUG

The following examples show how to use io.netty.handler.logging.LogLevel#DEBUG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NettyPistachioClientInitializer.java    From Pistachio with Apache License 2.0 6 votes vote down vote up
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc(), NettyPistachioClient.HOST, NettyPistachioClient.PORT));
    }

    LogLevel level = LogLevel.DEBUG;


    p.addLast(new LoggingHandler(level));
    p.addLast(new ReadTimeoutHandler(ConfigurationManager.getConfiguration().getInt("Network.Netty.ClientReadTimeoutMillis",10000), TimeUnit.MILLISECONDS));
    p.addLast(new ProtobufVarint32FrameDecoder());
    p.addLast(new ProtobufDecoder(NettyPistachioProtocol.Response.getDefaultInstance()));

    p.addLast(new ProtobufVarint32LengthFieldPrepender());
    p.addLast(new ProtobufEncoder());

    p.addLast(new NettyPistachioClientHandler());
}
 
Example 2
Source File: LibP2PNetwork.java    From teku with Apache License 2.0 5 votes vote down vote up
private Gossip createGossip() {
  GossipParams gossipParams =
      GossipParams.builder()
          .D(config.getGossipConfig().getD())
          .DLow(config.getGossipConfig().getDLow())
          .DHigh(config.getGossipConfig().getDHigh())
          .DLazy(config.getGossipConfig().getDLazy())
          .fanoutTTL(config.getGossipConfig().getFanoutTTL())
          .gossipSize(config.getGossipConfig().getAdvertise())
          .gossipHistoryLength(config.getGossipConfig().getHistory())
          .heartbeatInterval(config.getGossipConfig().getHeartbeatInterval())
          .build();

  GossipRouter router = new GossipRouter(gossipParams);
  router.setMessageIdGenerator(
      msg ->
          Base64.getUrlEncoder()
              .withoutPadding()
              .encodeToString(Hash.sha2_256(msg.getData().toByteArray())));

  ChannelHandler debugHandler =
      config.getWireLogsConfig().isLogWireGossip()
          ? new LoggingHandler("wire.gossip", LogLevel.DEBUG)
          : null;
  PubsubApi pubsubApi = PubsubApiKt.createPubsubApi(router);

  return new Gossip(router, pubsubApi, debugHandler);
}
 
Example 3
Source File: NettyServer.java    From util4j with Apache License 2.0 5 votes vote down vote up
protected ChannelFuture doBooterBind(InetSocketAddress local,final ChannelHandler fixedHandler) {
	ChannelFuture cf;
	synchronized (booter) {
		final CountDownLatch latch=new CountDownLatch(1);
		LoggerHandler loggerHandler=null;//server接收处理链路的日志记录器
		LogLevel level=config.getLevel();
		if(level==null)
		{
			level=LogLevel.DEBUG;
		}
		loggerHandler=new LoggerHandler(level);
		ChannelHandler childHandler=initLogHandlerAdapter(fixedHandler);
		booter.handler(loggerHandler).childHandler(childHandler);
		cf=booter.bind(local);
		cf.addListener(new ChannelFutureListener() {
			@Override
			public void operationComplete(ChannelFuture future) throws Exception {
				latch.countDown();
			}
		});
		try {
			latch.await(3,TimeUnit.SECONDS);
		} catch (Exception e) {
			log.error(e.getMessage(),e);
		}
	}
	return cf;
}
 
Example 4
Source File: IsoMessageLoggingHandlerTest.java    From jreactive-8583 with Apache License 2.0 5 votes vote down vote up
@Test
public void testMaskSensitiveData() {
    handler = new IsoMessageLoggingHandler(LogLevel.DEBUG, false, true, new int[]{34, 35, 36, 45, 112});

    final String result = handler.format(ctx, "someEvent", message);

    assertThat(result).doesNotContain(pan);
    assertThat(result).doesNotContain(cvv);
    assertThat(result).doesNotContain(track1);
    assertThat(result).doesNotContain(track2);
    assertThat(result).doesNotContain(track3);
}
 
Example 5
Source File: IsoMessageLoggingHandlerTest.java    From jreactive-8583 with Apache License 2.0 5 votes vote down vote up
@Test
public void testMaskDefaultSensitiveData() {
    handler = new IsoMessageLoggingHandler(LogLevel.DEBUG, false, true, DEFAULT_SENSITIVE_DATA_FIELDS);

    final String result = handler.format(ctx, "someEvent", message);

    assertThat(result).doesNotContain(pan);
    assertThat(result).doesNotContain(track1).as("track1");
    assertThat(result).doesNotContain(track2).as("track2");
    assertThat(result).doesNotContain(track3).as("track3");
    // there is no standard field for CVV, so it's not masked by default
    assertThat(result).contains(cvv);
}
 
Example 6
Source File: IsoMessageLoggingHandlerTest.java    From jreactive-8583 with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrintSensitiveData() {
    handler = new IsoMessageLoggingHandler(LogLevel.DEBUG, true, true, DEFAULT_SENSITIVE_DATA_FIELDS);

    final String result = handler.format(ctx, "someEvent", message);

    assertThat(result).contains(pan);
    assertThat(result).contains(cvv);
    assertThat(result).contains(track1);
    assertThat(result).contains(track2);
    assertThat(result).contains(track3);
}
 
Example 7
Source File: IsoMessageLoggingHandlerTest.java    From jreactive-8583 with Apache License 2.0 5 votes vote down vote up
@Test
public void testHideFieldDescriptions() {
    handler = new IsoMessageLoggingHandler(LogLevel.DEBUG, false, false, DEFAULT_SENSITIVE_DATA_FIELDS);

    final String result = handler.format(ctx, "someEvent", message);

    assertThat(result).doesNotContain("Primary account number (PAN)");
}
 
Example 8
Source File: IsoMessageLoggingHandlerTest.java    From jreactive-8583 with Apache License 2.0 5 votes vote down vote up
@Test
public void testShowFieldDescriptions() {
    handler = new IsoMessageLoggingHandler(LogLevel.DEBUG, false, true, DEFAULT_SENSITIVE_DATA_FIELDS);

    final String result = handler.format(ctx, "someEvent", message);

    assertThat(result).contains("Primary account number (PAN)");
}
 
Example 9
Source File: NettyServerHandler.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
static NettyServerHandler newHandler(
    ServerTransportListener transportListener,
    ChannelPromise channelUnused,
    List<ServerStreamTracer.Factory> streamTracerFactories,
    TransportTracer transportTracer,
    int maxStreams,
    int flowControlWindow,
    int maxHeaderListSize,
    int maxMessageSize,
    long keepAliveTimeInNanos,
    long keepAliveTimeoutInNanos,
    long maxConnectionIdleInNanos,
    long maxConnectionAgeInNanos,
    long maxConnectionAgeGraceInNanos,
    boolean permitKeepAliveWithoutCalls,
    long permitKeepAliveTimeInNanos) {
  Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive");
  Http2FrameLogger frameLogger = new Http2FrameLogger(LogLevel.DEBUG, NettyServerHandler.class);
  Http2HeadersDecoder headersDecoder = new GrpcHttp2ServerHeadersDecoder(maxHeaderListSize);
  Http2FrameReader frameReader = new Http2InboundFrameLogger(
      new DefaultHttp2FrameReader(headersDecoder), frameLogger);
  Http2FrameWriter frameWriter =
      new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(), frameLogger);
  return newHandler(
      channelUnused,
      frameReader,
      frameWriter,
      transportListener,
      streamTracerFactories,
      transportTracer,
      maxStreams,
      flowControlWindow,
      maxHeaderListSize,
      maxMessageSize,
      keepAliveTimeInNanos,
      keepAliveTimeoutInNanos,
      maxConnectionIdleInNanos,
      maxConnectionAgeInNanos,
      maxConnectionAgeGraceInNanos,
      permitKeepAliveWithoutCalls,
      permitKeepAliveTimeInNanos);
}
 
Example 10
Source File: Iso8583ChannelInitializer.java    From jreactive-8583 with Apache License 2.0 4 votes vote down vote up
protected ChannelHandler createLoggingHandler(C configuration) {
    return new IsoMessageLoggingHandler(LogLevel.DEBUG,
            configuration.logSensitiveData(),
            configuration.logFieldDescription(),
            configuration.getSensitiveDataFields());
}
 
Example 11
Source File: NettyPistachioServerInitializer.java    From Pistachio with Apache License 2.0 4 votes vote down vote up
@Override
public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }

    LogLevel level = LogLevel.DEBUG;



    p.addLast(new LoggingHandler(level));

    p.addLast(new ReadTimeoutHandler(ConfigurationManager.getConfiguration().getInt("Network.Netty.ServerReadTimeoutMillis",10000), TimeUnit.MILLISECONDS));
    p.addLast(new ProtobufVarint32FrameDecoder());
    p.addLast(new ProtobufDecoder(NettyPistachioProtocol.Request.getDefaultInstance()));

    p.addLast(new ProtobufVarint32LengthFieldPrepender());
    p.addLast(new ProtobufEncoder());

    p.addLast(new NettyPistachioServerHandler(handler));
}
 
Example 12
Source File: NettyServerHandler.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
static NettyServerHandler newHandler(
    ServerTransportListener transportListener,
    ChannelPromise channelUnused,
    List<? extends ServerStreamTracer.Factory> streamTracerFactories,
    TransportTracer transportTracer,
    int maxStreams,
    boolean autoFlowControl,
    int flowControlWindow,
    int maxHeaderListSize,
    int maxMessageSize,
    long keepAliveTimeInNanos,
    long keepAliveTimeoutInNanos,
    long maxConnectionIdleInNanos,
    long maxConnectionAgeInNanos,
    long maxConnectionAgeGraceInNanos,
    boolean permitKeepAliveWithoutCalls,
    long permitKeepAliveTimeInNanos) {
  Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive: %s",
      maxHeaderListSize);
  Http2FrameLogger frameLogger = new Http2FrameLogger(LogLevel.DEBUG, NettyServerHandler.class);
  Http2HeadersDecoder headersDecoder = new GrpcHttp2ServerHeadersDecoder(maxHeaderListSize);
  Http2FrameReader frameReader = new Http2InboundFrameLogger(
      new DefaultHttp2FrameReader(headersDecoder), frameLogger);
  Http2FrameWriter frameWriter =
      new Http2OutboundFrameLogger(new DefaultHttp2FrameWriter(), frameLogger);
  return newHandler(
      channelUnused,
      frameReader,
      frameWriter,
      transportListener,
      streamTracerFactories,
      transportTracer,
      maxStreams,
      autoFlowControl,
      flowControlWindow,
      maxHeaderListSize,
      maxMessageSize,
      keepAliveTimeInNanos,
      keepAliveTimeoutInNanos,
      maxConnectionIdleInNanos,
      maxConnectionAgeInNanos,
      maxConnectionAgeGraceInNanos,
      permitKeepAliveWithoutCalls,
      permitKeepAliveTimeInNanos);
}
 
Example 13
Source File: ProxyModule.java    From nomulus with Apache License 2.0 2 votes vote down vote up
/**
 * Provides shared logging handler.
 *
 * <p>Note that this handler always records logs at {@code LogLevel.DEBUG}, it is up to the JUL
 * logger that it contains to decide if logs at this level should actually be captured. The log
 * level of the JUL logger is configured in {@link #configureLogging()}.
 */
@Singleton
@Provides
LoggingHandler provideLoggingHandler() {
  return new LoggingHandler(LogLevel.DEBUG);
}