List of usage examples for io.netty.handler.logging LogLevel DEBUG
LogLevel DEBUG
To view the source code for io.netty.handler.logging LogLevel DEBUG.
Click Source Link
From source file:org.columbia.parikshan.proxy.NettyProxy.java
License:Apache License
public static void execute(int LOCAL_PORT, String REMOTE_HOST, int REMOTE_PORT) throws Exception { System.err.println("Proxying *:" + LOCAL_PORT + " to " + REMOTE_HOST + ':' + REMOTE_PORT + " ..."); LoggingHandler l;/*from w ww . java2s .c o m*/ if (Main.debug) l = new LoggingHandler(LogLevel.INFO); else l = new LoggingHandler(LogLevel.DEBUG); // Configure the bootstrap. EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).handler(l) .childHandler(new NettyProxyInitializer(REMOTE_HOST, REMOTE_PORT)) .childOption(ChannelOption.AUTO_READ, false).bind(LOCAL_PORT).sync().channel().closeFuture() .sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:org.columbia.parikshan.proxy.NettyProxyInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) { //ch.pipeline().addLast(new HexDumpProxyFrontendHandler(remoteHost,remotePort,remoteHost2,remotePort2)); ch.pipeline().addLast(new LoggingHandler(LogLevel.DEBUG), new NettyProxyFrontendHandler(remoteHost, remotePort)); }
From source file:org.fiware.kiara.transport.http.HttpServerInitializer.java
License:Open Source License
@Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline();/*from w ww . j av a 2 s .c o m*/ // Enable HTTPS if necessary. if (sslCtx != null) { p.addLast(sslCtx.newHandler(ch.alloc())); } p.addLast("logger", new LoggingHandler(LogLevel.DEBUG)); p.addLast(new HttpServerCodec()); //p.addLast(new HttpRequestDecoder()); // Uncomment the following line if you don't want to handle HttpChunks. //p.addLast(new HttpObjectAggregator(1048576)); //p.addLast(new HttpResponseEncoder()); // Remove the following line if you don't want automatic content compression. //p.addLast(new HttpContentCompressor()); p.addLast("aggregator", new HttpObjectAggregator(1048576)); p.addLast(new HttpHandler(transport, path, connectionListener)); }
From source file:org.fiware.kiara.transport.tcp.TcpServerInitializer.java
License:Open Source License
@Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline();/*from ww w. ja v a 2 s. c o m*/ // Enable TCPS if necessary. if (sslCtx != null) { p.addLast(sslCtx.newHandler(ch.alloc())); } p.addLast("logger", new LoggingHandler(LogLevel.DEBUG)); p.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, Integer.MAX_VALUE, 0, 4, 0, 4, true)); p.addLast(new ByteBufferDecoder()); p.addLast(new LengthFieldPrepender(4, 0, false) { @Override protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception { ByteBuf outWithLittleEndian = out.order(ByteOrder.LITTLE_ENDIAN); super.encode(ctx, msg, outWithLittleEndian); } }); p.addLast(new ByteBufferEncoder()); p.addLast(new TcpHandler(transportFactory, path, connectionListener)); }
From source file:org.hawkular.apm.tests.client.http.NettyHttpITest.java
License:Apache License
@Override public void init() { server = HttpServer.newServer().enableWireLogging(LogLevel.DEBUG).start((req, resp) -> { if (req.getHeader(Constants.HAWKULAR_APM_TRACEID) == null) { return resp.setStatus(HttpResponseStatus.BAD_REQUEST); }//from ww w .j ava 2 s . co m if (req.getHttpMethod() == HttpMethod.POST || req.getHttpMethod() == HttpMethod.PUT) { req.getContent().subscribe(bb -> System.out.println("DATA = " + bb.toString())); } return resp.writeString(Observable.just(HELLO_WORLD)); }); super.init(); }
From source file:org.hawkular.apm.tests.client.http.NettyNoResponseHttpITest.java
License:Apache License
@Override public void init() { server = HttpServer.newServer().enableWireLogging(LogLevel.DEBUG).start((req, resp) -> { if (req.getHeader(Constants.HAWKULAR_APM_TRACEID) == null) { return resp.setStatus(HttpResponseStatus.BAD_REQUEST); }/*from w w w . j av a 2 s. c o m*/ if (req.getHttpMethod() == HttpMethod.POST || req.getHttpMethod() == HttpMethod.PUT) { req.getContent().subscribe(bb -> System.out.println("DATA = " + bb.toString())); } resp.setStatus(HttpResponseStatus.OK); return resp; }); super.init(); }
From source file:org.jooby.internal.netty.NettyPipeline.java
License:Apache License
private Http2ConnectionHandler newHttp2ConnectionHandler(final ChannelPipeline p) { DefaultHttp2Connection connection = new DefaultHttp2Connection(true); InboundHttp2ToHttpAdapter listener = new InboundHttp2ToHttpAdapterBuilder(connection) .propagateSettings(false).validateHttpHeaders(false).maxContentLength(maxContentLength).build(); HttpToHttp2ConnectionHandler http2handler = new HttpToHttp2ConnectionHandlerBuilder() .frameListener(listener).frameLogger(new Http2FrameLogger(LogLevel.DEBUG)).connection(connection) .build();/*from w w w. j ava 2 s . c o m*/ return http2handler; }
From source file:org.jooby.internal.netty.NettyServer.java
License:Apache License
private Channel bootstrap(final EventExecutorGroup executor, final SslContext sslCtx, final int port) throws InterruptedException { ServerBootstrap bootstrap = new ServerBootstrap(); boolean epoll = bossLoop instanceof EpollEventLoopGroup; bootstrap.group(bossLoop, workerLoop) .channel(epoll ? EpollServerSocketChannel.class : NioServerSocketChannel.class) .handler(new LoggingHandler(Server.class, LogLevel.DEBUG)) .childHandler(new NettyPipeline(executor, dispatcher, conf, sslCtx)); configure(conf.getConfig("netty.options"), "netty.options", (option, value) -> bootstrap.option(option, value)); configure(conf.getConfig("netty.worker.options"), "netty.worker.options", (option, value) -> bootstrap.childOption(option, value)); return bootstrap.bind(host(conf.getString("application.host")), port).sync().channel(); }
From source file:org.msrpenabler.server.net.NioMsrpSockClientBootStrap.java
License:Apache License
public void init(final MsrpConnexion cnx) throws Exception { // Configure the client. bootClt = new Bootstrap(); bootClt = bootClt.group(workerGroup).channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { // Create a new socket / channel / pipeline for each new Cnx @Override/*from www . ja v a 2 s . c o m*/ public void initChannel(SocketChannel ch) throws Exception { // Set channel in msrpConnexion cnx.setChannel(ch); ch.pipeline().addLast(new LoggingHandler(LogLevel.DEBUG), // Rcv decoder new NioMsrpMsgDecoder(), // Send encoder new NioMsrpMsgEncoder(), // Inbounds Msg Handler new MsgRcvHandler(cnx)); } }); }
From source file:org.msrpenabler.server.net.NioMsrpSockServerBootStrap.java
License:Apache License
public void run() throws Exception { // Configure the server. ServerBootstrap b = new ServerBootstrap(); b = b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .option(ChannelOption.SO_BACKLOG, 500) // maximum queue length sock waiting to be accepted .handler(new LoggingHandler(LogLevel.INFO)).childHandler(new ChannelInitializer<SocketChannel>() { // Create a new socket / channel / pipeline for each new Cnx @Override/* www . ja v a 2s. c o m*/ public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new LoggingHandler(LogLevel.DEBUG)); ch.pipeline().addLast(new NioMsrpMsgDecoder()); ch.pipeline().addLast(new NioMsrpMsgEncoder()); ch.pipeline().addLast("msrpHandler", new MsgRcvHandler(addrServ)); } }); // Start the server. futureBind = b.bind(addrServ.inetAddr, addrServ.port); futureBind.addListener(new ChannelFutureListener() { public void operationComplete(ChannelFuture future) { if (future.isSuccess()) { logger.info(" Bind success on {}:{}", addrServ.inetAddr, addrServ.port); } else { logger.error(" Bind failed on {}:{}", addrServ.inetAddr, addrServ.port, future.cause()); } } }); }