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:net.anyflow.menton.http.WebServerChannelInitializer.java
License:Apache License
@Override protected void initChannel(SocketChannel ch) throws Exception { if ("true".equalsIgnoreCase(Settings.SELF.getProperty("menton.logging.writelogOfNettyLogger"))) { ch.pipeline().addLast("log", new LoggingHandler("menton/server", LogLevel.DEBUG)); }/*from ww w. ja v a 2 s .c om*/ if (useSsl) { SslContext sslCtx = SslContextBuilder .forServer(Settings.SELF.certChainFile(), Settings.SELF.privateKeyFile()).build(); logger.debug("SSL Provider : {}", SslContext.defaultServerProvider()); ch.pipeline().addLast(sslCtx.newHandler(ch.alloc())); } ch.pipeline().addLast(HttpServerCodec.class.getName(), new HttpServerCodec()); ch.pipeline().addLast(HttpObjectAggregator.class.getName(), new HttpObjectAggregator(1048576)); ch.pipeline().addLast(HttpContentCompressor.class.getName(), new HttpContentCompressor()); ch.pipeline().addLast(HttpRequestRouter.class.getName(), new HttpRequestRouter()); if (websocketFrameHandlerClass != null) { WebsocketFrameHandler wsfh = websocketFrameHandlerClass.newInstance(); ch.pipeline().addLast(WebSocketServerProtocolHandler.class.getName(), new WebSocketServerProtocolHandler(wsfh.websocketPath(), wsfh.subprotocols(), wsfh.allowExtensions(), wsfh.maxFrameSize())); ch.pipeline().addLast(wsfh); } }
From source file:net.kuujo.copycat.io.transport.NettyServer.java
License:Apache License
/** * Starts listening for the given member. *//* w w w . j a va2 s . c o m*/ private void listen(Address address, Consumer<Connection> listener, Context context) { channelGroup = new DefaultChannelGroup("copycat-acceptor-channels", GlobalEventExecutor.INSTANCE); handler = new ServerHandler(connections, listener, context); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(eventLoopGroup) .channel(eventLoopGroup instanceof EpollEventLoopGroup ? EpollServerSocketChannel.class : NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)).childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast(FIELD_PREPENDER); pipeline.addLast(new LengthFieldBasedFrameDecoder(1024 * 32, 0, 2, 0, 2)); pipeline.addLast(handler); } }).option(ChannelOption.SO_BACKLOG, 128).option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.SO_REUSEADDR, true).childOption(ChannelOption.ALLOCATOR, ALLOCATOR) .childOption(ChannelOption.SO_KEEPALIVE, true); LOGGER.info("Binding to {}", address); ChannelFuture bindFuture = bootstrap.bind(address.socketAddress()); bindFuture.addListener((ChannelFutureListener) channelFuture -> { if (channelFuture.isSuccess()) { listening = true; context.executor().execute(() -> { LOGGER.info("Listening at {}", bindFuture.channel().localAddress()); listenFuture.complete(null); }); } else { context.execute(() -> listenFuture.completeExceptionally(channelFuture.cause())); } }); channelGroup.add(bindFuture.channel()); }
From source file:net.smert.frameworkgl.Network.java
License:Apache License
public void setLogLevelDebug() { this.logLevel = LogLevel.DEBUG; }
From source file:org.aaron.sms.protocol.SMSProtocolChannelInitializer.java
License:Open Source License
@Override protected void initChannel(Channel ch) throws Exception { final ChannelPipeline p = ch.pipeline(); p.addLast("logger", new LoggingHandler(LogLevel.DEBUG)); p.addLast("frameEncoder", new LengthFieldPrepender(SMSProtocolConstants.MESSAGE_HEADER_LENGTH_BYTES)); p.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(SMSProtocolConstants.MAX_MESSAGE_LENGTH_BYTES, 0, SMSProtocolConstants.MESSAGE_HEADER_LENGTH_BYTES, 0, SMSProtocolConstants.MESSAGE_HEADER_LENGTH_BYTES)); p.addLast("protobufEncoder", new ProtobufEncoder()); p.addLast("protobufDecoder", new ProtobufDecoder(messagePrototype)); p.addLast("customHandler", handlerSupplier.get()); }
From source file:org.apache.hyracks.http.server.HttpServer.java
License:Apache License
protected void doStart() throws InterruptedException { /*// w w w.ja v a 2 s. c o m * This is a hacky way to ensure that IServlets with more specific paths are checked first. * For example: * "/path/to/resource/" * is checked before * "/path/to/" * which in turn is checked before * "/path/" * Note that it doesn't work for the case where multiple paths map to a single IServlet */ Collections.sort(servlets, (l1, l2) -> l2.getPaths()[0].length() - l1.getPaths()[0].length()); ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .childOption(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(RECEIVE_BUFFER_SIZE)) .childOption(ChannelOption.AUTO_READ, Boolean.FALSE) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, WRITE_BUFFER_WATER_MARK) .handler(new LoggingHandler(LogLevel.DEBUG)).childHandler(new HttpServerInitializer(this)); channel = b.bind(port).sync().channel(); }
From source file:org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer.java
License:Apache License
@Override public void configure(final ChannelPipeline pipeline) { if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-io", LogLevel.DEBUG)); pipeline.addLast("http-server", new HttpServerCodec()); if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("http-io", LogLevel.DEBUG)); pipeline.addLast(new HttpObjectAggregator(settings.maxContentLength)); if (authenticator != null) { // Cannot add the same handler instance to multiple times unless // it is marked as @Sharable, indicating a race condition will // not occur. It may not be a safe assumption that the handler // is sharable so create a new handler each time. authenticationHandler = authenticator.getClass() == AllowAllAuthenticator.class ? null : new HttpBasicAuthenticationHandler(authenticator); if (authenticationHandler != null) pipeline.addLast(PIPELINE_AUTHENTICATOR, authenticationHandler); }/*w w w. jav a 2 s . c o m*/ pipeline.addLast("http-gremlin-handler", httpGremlinEndpointHandler); }
From source file:org.apache.tinkerpop.gremlin.server.channel.NioChannelizer.java
License:Apache License
@Override public void configure(final ChannelPipeline pipeline) { if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-io", LogLevel.DEBUG)); pipeline.addLast("nio-frame-encoder", nioGremlinResponseFrameEncoder); pipeline.addLast("response-frame-encoder", gremlinResponseFrameEncoder); pipeline.addLast("request-binary-decoder", new NioGremlinBinaryRequestDecoder(serializers)); if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-codec", LogLevel.DEBUG)); if (authenticationHandler != null) pipeline.addLast(PIPELINE_AUTHENTICATOR, authenticationHandler); }
From source file:org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer.java
License:Apache License
@Override public void configure(final ChannelPipeline pipeline) { if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-io", LogLevel.DEBUG)); logger.debug("HttpRequestDecoder settings - maxInitialLineLength={}, maxHeaderSize={}, maxChunkSize={}", settings.maxInitialLineLength, settings.maxHeaderSize, settings.maxChunkSize); pipeline.addLast("http-request-decoder", new HttpRequestDecoder(settings.maxInitialLineLength, settings.maxHeaderSize, settings.maxChunkSize)); if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-decoder-aggregator", LogLevel.DEBUG)); logger.debug("HttpObjectAggregator settings - maxContentLength={}, maxAccumulationBufferComponents={}", settings.maxContentLength, settings.maxAccumulationBufferComponents); final HttpObjectAggregator aggregator = new HttpObjectAggregator(settings.maxContentLength); aggregator.setMaxCumulationBufferComponents(settings.maxAccumulationBufferComponents); pipeline.addLast("aggregator", aggregator); if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-aggregator-encoder", LogLevel.DEBUG)); pipeline.addLast("http-response-encoder", new HttpResponseEncoder()); pipeline.addLast("request-handler", new WebSocketServerProtocolHandler("/gremlin", null, false, settings.maxContentLength)); if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-aggregator-encoder", LogLevel.DEBUG)); pipeline.addLast("ws-frame-encoder", wsGremlinResponseFrameEncoder); pipeline.addLast("response-frame-encoder", gremlinResponseFrameEncoder); pipeline.addLast("request-text-decoder", wsGremlinTextRequestDecoder); pipeline.addLast("request-binary-decoder", wsGremlinBinaryRequestDecoder); pipeline.addLast("request-close-decoder", wsGremlinCloseRequestDecoder); if (logger.isDebugEnabled()) pipeline.addLast(new LoggingHandler("log-aggregator-encoder", LogLevel.DEBUG)); if (authenticationHandler != null) pipeline.addLast(PIPELINE_AUTHENTICATOR, authenticationHandler); }
From source file:org.betawares.jorre.Server.java
License:Open Source License
/** * Starts the Server with the specified {@link Connection} settings. * /*from w w w. j ava 2 s . c o m*/ * @param connection a {@link Connection} instance specifying the connection settings * * @throws Exception thrown if there is an error starting the server */ public void start(Connection connection) throws Exception { SslContext sslCtx; if (connection.isSSL()) { SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build(); } else { sslCtx = null; } bossGroup = new NioEventLoopGroup(); workerGroup = new NioEventLoopGroup(); ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)).childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) { if (sslCtx != null) { ch.pipeline().addLast(sslCtx.newHandler(ch.alloc())); } ch.pipeline() .addLast(new ObjectDecoder(10 * 1024 * 1024, ClassResolvers.cacheDisabled(null))); ch.pipeline().addLast(encoder); ch.pipeline().addLast("idleStateHandler", new IdleStateHandler(connection.getIdleTimeout(), connection.getIdlePingTime(), 0, TimeUnit.MILLISECONDS)); ch.pipeline().addLast(handlersExecutor, "heartbeatHandler", new ServerHeartbeatHandler(Server.this)); ch.pipeline().addLast("pingMessageHandler", pingMessageHandler); ch.pipeline().addLast("pongMessageHandler", pongMessageHandler); ch.pipeline().addLast("connectionHandler", new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { clients.add(ctx.channel()); ctx.pipeline().remove(this); super.channelActive(ctx); } }); ch.pipeline().addLast(handlersExecutor, "serverMessageHandler", serverRequestHandler); ch.pipeline().addLast("exceptionHandler", exceptionHandler); } }); bootstrap.bind(connection.getPort()).sync(); }
From source file:org.columbia.parikshan.duplicator.DuplicatorProxyInitializer.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 DuplicatorFrontendHandler(remoteHost, remotePort, remoteHost2, remotePort2)); }