Example usage for io.netty.handler.logging LogLevel TRACE

List of usage examples for io.netty.handler.logging LogLevel TRACE

Introduction

In this page you can find the example usage for io.netty.handler.logging LogLevel TRACE.

Prototype

LogLevel TRACE

To view the source code for io.netty.handler.logging LogLevel TRACE.

Click Source Link

Usage

From source file:org.eclipse.scada.protocol.iec60870.server.Server.java

License:Open Source License

protected void handleInitChannel(final SocketChannel ch) {
    // add the APCI/APDU handler
    ch.pipeline().addLast(new APDUDecoder());
    ch.pipeline().addLast(new APDUEncoder());

    // add logging
    if (Boolean.getBoolean("org.eclipse.scada.protocol.iec60870.trace")) {
        ch.pipeline().addLast(new LoggingHandler(LogLevel.TRACE));
    }//  www . java2  s . c om

    final MessageChannel messageChannel = new MessageChannel(this.options, this.manager);

    // message channel
    ch.pipeline().addLast(messageChannel);

    // now add all server modules

    for (final ServerModule module : this.modules) {
        module.initializeChannel(ch, messageChannel);
    }

    // finally add the default exception catcher

    ch.pipeline().addLast(new ChannelDuplexHandler() {
        @Override
        public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception {
            logger.warn("Close connection due to uncaught exception", cause);
            ctx.close();
        }
    });
}

From source file:org.elasticsearch.transport.netty4.ESLoggingHandler.java

License:Apache License

ESLoggingHandler() {
    super(LogLevel.TRACE);
}

From source file:org.infinispan.rest.http2.Http11ClientInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();//from  w w  w  .  j  a v a2  s.  c  o m

    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }

    p.addLast(new HttpClientCodec());
    p.addLast(new HttpContentDecompressor());
    p.addLast(new HttpObjectAggregator(maxContentLength));
    p.addLast(communicationHandler);
    p.addLast(new LoggingHandler(LogLevel.TRACE));
}

From source file:org.opendaylight.capwap.ODLCapwapACServer.java

License:Open Source License

@Override
public void start() throws Exception {

    final Bootstrap b = new Bootstrap();
    b.group(group);/*from   w w  w.j a  v a2  s . c o  m*/
    b.channel(NioDatagramChannel.class);
    b.option(ChannelOption.SO_BROADCAST, true);
    b.handler(new ChannelInitializer<NioDatagramChannel>() {
        @Override
        public void initChannel(final NioDatagramChannel ch) throws Exception {

            ChannelPipeline p = ch.pipeline();
            if (security == SecurityType.DTLS) {
                p.addLast(new LoggingHandler("CapwapACServer Log 2", LogLevel.TRACE));
                ChannelHandler dtlsHandler = UscPluginUdp.getSecureServerHandler(ch);
                p.addLast(dtlsHandler);
            }
            p.addLast(new LoggingHandler("CapwapACServer Log 1", LogLevel.TRACE));
            p.addLast(new CapwapPacketHandler());
        }
    });
    b.bind(port).sync().channel().closeFuture().await();
}

From source file:org.opendaylight.usc.agent.UscAgentTcp.java

License:Open Source License

public UscAgentTcp(boolean callHome, InetAddress host, String propertyFile) {
    final UscAgentTcp agent = this;
    UscConfigurationServiceImpl.setDefaultPropertyFilePath(propertyFile);
    secureService = UscServiceUtils.getService(UscSecureService.class);
    b.group(bossGroup, workerGroup);//from  ww w .  j av  a2  s  . c  o m
    b.channel(NioServerSocketChannel.class);
    b.handler(new LoggingHandler("UscAgentTcp server handler", LogLevel.TRACE));
    b.childHandler(new ChannelInitializer<NioSocketChannel>() {
        @Override
        public void initChannel(NioSocketChannel ch) throws Exception {
            if (secureService == null) {
                LOG.error("UscSecureService is not initialized!");
                return;
            }
            ChannelPipeline p = ch.pipeline();
            agentServerChannel = ch;
            p.addLast(new LoggingHandler("UscAgentTcp PLUGIN5", LogLevel.TRACE));
            p.addLast(secureService.getTcpServerHandler(ch));
            p.addLast(new LoggingHandler("UscAgentTcp PLUGIN4", LogLevel.TRACE));
            p.addLast(new UscFrameEncoderTcp());
            p.addLast(new LoggingHandler("UscAgentTcp PLUGIN3", LogLevel.TRACE));
            p.addLast(new UscFrameDecoderTcp());
            p.addLast(new LoggingHandler("UscAgentTcp PLUGIN2", LogLevel.TRACE));
            p.addLast(new UscAgentTcpHandler(agent, ch));
            p.addLast(new LoggingHandler("UscAgentTcp PLUGIN1", LogLevel.TRACE));
        }
    });

    if (callHome) {
        cb.group(callHomeGroup);
        cb.channel(NioSocketChannel.class);
        cb.handler(new ChannelInitializer<NioSocketChannel>() {
            @Override
            public void initChannel(NioSocketChannel ch) throws Exception {
                if (secureService == null) {
                    LOG.error("UscSecureService is not initialized!");
                    return;
                }
                ChannelPipeline p = ch.pipeline();
                agentServerChannel = ch;
                p.addLast(new LoggingHandler("UscAgentTcp Handler5", LogLevel.TRACE));
                p.addLast(secureService.getTcpClientHandler(ch));
                p.addLast(new LoggingHandler("UscAgentTcp Handler4", LogLevel.TRACE));
                p.addLast(new UscFrameEncoderTcp());
                p.addLast(new LoggingHandler("UscAgentTcp Handler3", LogLevel.TRACE));
                p.addLast(new UscFrameDecoderTcp());
                p.addLast(new LoggingHandler("UscAgentTcp Handler2", LogLevel.TRACE));
                p.addLast(new UscAgentTcpHandler(agent, ch));
                p.addLast(new LoggingHandler("UscAgentTcp Handler1", LogLevel.TRACE));
            }
        });

        try {
            cb.connect(host, 1069).sync();
        } catch (Exception e) {
            // TODO Auto-generated catch block

            LOG.error("USC Plugin call home port not available; call home disabled");
            // e.printStackTrace();
        }
    }
}

From source file:org.opendaylight.usc.agent.UscAgentTcpHandler.java

License:Open Source License

public UscAgentTcpHandler(UscAgentTcp agent, SocketChannel ch) {
    this.agent = agent;
    this.plugin = ch;
    cb.group(clientGroup);//from  ww  w  .  ja  v  a2 s.  c o  m
    cb.channel(NioSocketChannel.class);
    cb.handler(new ChannelInitializer<NioSocketChannel>() {

        @Override
        protected void initChannel(NioSocketChannel ch) throws Exception {
            ChannelPipeline p = ch.pipeline();
            p.addLast(new LoggingHandler("UscAgentTcpHandler", LogLevel.TRACE));
            p.addLast(new ClientHandler());
        }
    });
}

From source file:org.opendaylight.usc.agent.UscAgentUdp.java

License:Open Source License

public UscAgentUdp(boolean callHome, InetAddress host, String propertyFile) {
    final UscAgentUdp agent = this;
    UscConfigurationServiceImpl.setDefaultPropertyFilePath(propertyFile);
    secureService = UscServiceUtils.getService(UscSecureService.class);
    b.group(bossGroup);/*from  w  w  w  . ja  v  a  2 s  . c  om*/
    b.channel(NioDatagramChannel.class);
    b.handler(new ChannelInitializer<NioDatagramChannel>() {
        @Override
        public void initChannel(NioDatagramChannel ch) throws Exception {
            ChannelPipeline p = ch.pipeline();
            agentServerChannel = ch;
            p.addLast(new ChannelInboundHandlerAdapter() {

                @Override
                public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                    final Channel ch = ctx.channel();
                    final InetSocketAddress remoteAddress = ((DatagramPacket) msg).sender();

                    // this is to deal with UDP channels which don't by
                    // default have remote address
                    if (ch.remoteAddress() == null) {
                        ch.connect(remoteAddress);
                    }
                    ch.pipeline().remove(this);
                    super.channelRead(ctx, msg);
                }

            });
            if (secureService == null) {
                LOG.error("UscSecureService is not initialized!");
                return;
            }
            p.addLast(new LoggingHandler("UscAgnet Handler 5", LogLevel.TRACE));
            p.addLast(secureService.getUdpServerHandler(ch));
            p.addLast(new LoggingHandler("UscAgnet Handler 4", LogLevel.TRACE));
            p.addLast(new UscFrameEncoderUdp());
            p.addLast(new LoggingHandler("UscAgnet Handler 3", LogLevel.TRACE));
            p.addLast(new UscFrameDecoderUdp());
            p.addLast(new LoggingHandler("UscAgnet Handler 2", LogLevel.TRACE));
            p.addLast(new UscAgentUdpHandler(agent, ch));
            p.addLast(new LoggingHandler("UscAgnet Handler 1", LogLevel.TRACE));

        }
    });

    if (callHome) {
        cb.group(callHomeGroup);
        cb.channel(NioDatagramChannel.class);
        cb.handler(new ChannelInitializer<NioDatagramChannel>() {
            @Override
            public void initChannel(NioDatagramChannel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                agentServerChannel = ch;
                p.addLast(new ChannelInboundHandlerAdapter() {

                    @Override
                    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                        final Channel ch = ctx.channel();
                        final InetSocketAddress remoteAddress = ((DatagramPacket) msg).sender();

                        // this is to deal with UDP channels which don't by
                        // default have remote address
                        if (ch.remoteAddress() == null) {
                            ch.connect(remoteAddress);
                        }
                        ch.pipeline().remove(this);
                        super.channelRead(ctx, msg);
                    }

                });
                if (secureService == null) {
                    LOG.error("UscSecureService is not initialized!");
                    return;
                }
                p.addLast(new LoggingHandler("LOG2-5", LogLevel.TRACE));
                p.addLast(secureService.getUdpClientHandler(ch));
                p.addLast(new LoggingHandler("LOG2-4", LogLevel.TRACE));
                p.addLast(new UscFrameEncoderUdp());
                p.addLast(new LoggingHandler("LOG2-3", LogLevel.TRACE));
                p.addLast(new UscFrameDecoderUdp());
                p.addLast(new LoggingHandler("LOG2-2", LogLevel.TRACE));
                p.addLast(new UscAgentUdpHandler(agent, ch));
                p.addLast(new LoggingHandler("LOG2-1", LogLevel.TRACE));

            }
        });

        try {
            InetSocketAddress recipient = new InetSocketAddress(host, 1069);
            cb.connect(recipient).sync().channel();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:org.opendaylight.usc.agent.UscAgentUdpHandler.java

License:Open Source License

public UscAgentUdpHandler(UscAgentUdp agent, NioDatagramChannel ch) {
    this.agent = agent;
    this.plugin = ch;
    cb.group(clientGroup);/*from w  w  w .  java  2  s. c o m*/
    cb.channel(NioDatagramChannel.class);
    cb.handler(new ChannelInitializer<NioDatagramChannel>() {

        @Override
        protected void initChannel(NioDatagramChannel ch) throws Exception {
            LOG.trace("initChannel: clientHandler connects to EchoServer.");
            ChannelPipeline p = ch.pipeline();
            p.addLast(new LoggingHandler("UscAgentUdpHandler 2", LogLevel.TRACE));
            p.addLast(new ClientHandler());
            p.addLast(new LoggingHandler("UscAgentUdpHandler 2", LogLevel.TRACE));
        }
    });
}

From source file:org.opendaylight.usc.plugin.UscPlugin.java

License:Open Source License

protected UscPlugin(LocalAddress localAddr) {
    LOG.debug("UscPlugin " + this + "started");
    localServerAddr = localAddr;/*w  w  w  .java  2  s  .c o  m*/

    final ServerBootstrap localServerBootstrap = new ServerBootstrap();
    localServerBootstrap.group(localGroup);
    localServerBootstrap.channel(LocalServerChannel.class);
    localServerBootstrap.childHandler(new ChannelInitializer<LocalChannel>() {
        @Override
        public void initChannel(final LocalChannel serverChannel) throws Exception {
            ChannelPipeline p = serverChannel.pipeline();
            p.addLast(new LoggingHandler("localServerBootstrp Handler 4", LogLevel.TRACE));

            // call this first so that the attribute will be visible
            // to the outside once the localAddress is set
            serverChannel.attr(SESSION).setIfAbsent(SettableFuture.<UscSessionImpl>create());

            // register the child channel by address for lookup
            // outside
            LocalAddress localAddress = serverChannel.remoteAddress();
            serverChannels.putIfAbsent(localAddress, SettableFuture.<LocalChannel>create());
            serverChannels.get(localAddress).set(serverChannel);

            p.addLast(new LoggingHandler("localServerBootstrp Handler 3", LogLevel.TRACE));

            // add remote device handler for route remote request
            p.addLast(remoteDeviceHandler);
            p.addLast(new LoggingHandler("localServerBootstrp Handler 2", LogLevel.TRACE));
            p.addLast(getMultiplexer());
            p.addLast(new LoggingHandler("localServerBootstrp Handler 1", LogLevel.TRACE));
        }
    });

    // Start the server.
    final ChannelFuture serverChannelFuture = localServerBootstrap.bind(localServerAddr);
    LOG.debug("serverChannel: " + serverChannelFuture);
}

From source file:org.opendaylight.usc.plugin.UscPlugin.java

License:Open Source License

protected void initAgentPipeline(ChannelPipeline p, ChannelHandler securityHandler) {

    p.addLast(new LoggingHandler("UscPlugin Handler 6", LogLevel.TRACE));

    // security handler
    p.addLast("securityHandler", securityHandler);
    p.addLast(new LoggingHandler("UscPlugin Handler 5", LogLevel.TRACE));

    // Encoders/*from w ww.  j a  va 2s.com*/
    // UscFrameEncoder is Sharable
    p.addLast("frameEncoder", getFrameEncoder());
    p.addLast(new LoggingHandler("UscPlugin Handler 4", LogLevel.TRACE));

    // Decoders
    // UscFrameDecoderUdp is Sharable
    p.addLast("frameDecoder", getFrameDecoder());
    p.addLast(new LoggingHandler("UscPlugin Handler 3", LogLevel.TRACE));

    // add handler for handling response for remote session like a dummy
    // server
    p.addLast(remoteServerHandler);

    p.addLast(new LoggingHandler("UscPlugin Handler 2", LogLevel.TRACE));
    // UscDemultiplexer
    p.addLast("UscDemultiplexer", getDemultiplexer());

    p.addLast(new LoggingHandler("UscPlugin Handler 1", LogLevel.TRACE));
}