List of usage examples for io.netty.handler.logging LogLevel TRACE
LogLevel TRACE
To view the source code for io.netty.handler.logging LogLevel TRACE.
Click Source Link
From source file:org.opendaylight.usc.plugin.UscPlugin.java
License:Open Source License
protected void initDirectPipeline(ChannelPipeline p, ChannelHandler securityHandler) { p.addLast(new LoggingHandler("UscPlugin direct handler 4", LogLevel.TRACE)); // security handler p.addLast("securityHandler", securityHandler); p.addLast(new LoggingHandler("UscPlugin direct handler 3", LogLevel.TRACE)); // add handler for handling response for remote session like a dummy // server//from w w w. j av a 2 s. com p.addLast(remoteServerHandler); p.addLast(new LoggingHandler("UscPlugin direct handler 2", LogLevel.TRACE)); // demultiplexer p.addLast("Demultiplexer", getDmpx()); p.addLast(new LoggingHandler("UscPlugin direct handler 1", LogLevel.TRACE)); }
From source file:org.opendaylight.usc.plugin.UscPluginUdp.java
License:Open Source License
/** * Constructs a new UscPluginUdp//from w w w . j a v a 2 s .co m */ public UscPluginUdp() { super(new LocalAddress("usc-local-server-udp")); UscRouteBrokerService routeBroker = UscServiceUtils.getService(UscRouteBrokerService.class); if (routeBroker != null) { routeBroker.setConnetionManager(ChannelType.UDP, super.getConnectionManager()); routeBroker.setConnetionManager(ChannelType.DTLS, super.getConnectionManager()); } else { log.error("UscRouteBrokerService is not found, failed to set connection manager for all UDP Channel!"); } configService = UscServiceUtils.getService(UscConfigurationService.class); secureService = UscServiceUtils.getService(UscSecureService.class); agentBootstrap.group(agentGroup); agentBootstrap.channel(NioDatagramChannel.class); agentBootstrap.handler(new ChannelInitializer<Channel>() { @Override public void initChannel(final Channel ch) throws Exception { if (secureService == null) { log.error("UscSecureService is not initialized!"); return; } ChannelPipeline p = ch.pipeline(); ChannelHandler dtlsHandler = secureService.getUdpClientHandler(ch); initAgentPipeline(p, dtlsHandler); } }); final Bootstrap callHomeServerUdpBootstrap = new Bootstrap(); callHomeServerUdpBootstrap.group(agentGroup); callHomeServerUdpBootstrap.channel(NioDatagramChannel.class); callHomeServerUdpBootstrap.handler(new ChannelInitializer<NioDatagramChannel>() { @Override public void initChannel(final NioDatagramChannel ch) throws Exception { if (secureService == null) { log.error("UscSecureService is not initialized!"); return; } ChannelPipeline p = ch.pipeline(); // no remoteAddress yet until data received, so need a // handler // to add the channel p.addLast("callHomeHandler", callHomeHandler); p.addLast(new LoggingHandler(LogLevel.TRACE)); ChannelHandler dtlsHandler = secureService.getUdpServerHandler(ch); initAgentPipeline(ch.pipeline(), dtlsHandler); } }); if (configService == null) { log.error("UscConfigurationService is not initialized!"); return; } int pluginPort = configService.getConfigIntValue(UscConfigurationService.USC_PLUGIN_PORT); final ChannelFuture callHomeChannelUdpFuture = callHomeServerUdpBootstrap.bind(pluginPort); log.debug("callHomeChannelUdpFuture : " + callHomeChannelUdpFuture); try { callHomeChannelUdpFuture.sync(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.opendaylight.usc.test.EchoServerTcp.java
License:Open Source License
public EchoServerTcp(final boolean enableEncryption, int port) { PORT = port;/* w w w.j a v a 2s. c o m*/ UscConfigurationServiceImpl.setDefaultPropertyFilePath("resources/etc/usc/usc.properties"); secureService = UscServiceUtils.getService(UscSecureService.class); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 100) .handler(new LoggingHandler("EchoServerTcp server handler", LogLevel.TRACE)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { System.out.println("EchoServerTcp initChannel"); ChannelPipeline p = ch.pipeline(); if (enableEncryption) { p.addLast(new LoggingHandler("EchoServerTcp Handler 3", LogLevel.TRACE)); p.addLast(secureService.getTcpServerHandler(ch)); } p.addLast(new LoggingHandler("EchoServerTcp Handler 2", LogLevel.TRACE)); p.addLast(new EchoServerTcpHandler()); p.addLast(new LoggingHandler("EchoServerTcp Handler 1", LogLevel.TRACE)); } }); }
From source file:org.opendaylight.usc.test.EchoServerUdp.java
License:Open Source License
public EchoServerUdp(final boolean enableEncryption, int port) { PORT = port;//from w ww. ja v a2 s. c o m UscConfigurationServiceImpl.setDefaultPropertyFilePath("resources/etc/usc/usc.properties"); secureService = UscServiceUtils.getService(UscSecureService.class); b.group(bossGroup).channel(NioDatagramChannel.class).handler(new ChannelInitializer<DatagramChannel>() { @Override public void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); System.out.println("EchoServerUdp initChannel"); if (enableEncryption) { p.addLast(new LoggingHandler("EchoServerUdp Handler 3", LogLevel.TRACE)); p.addLast(secureService.getUdpServerHandler(ch)); } p.addLast(new LoggingHandler("EchoServerUdp Handler 2", LogLevel.TRACE)); p.addLast(new EchoServerUdpHandler()); p.addLast(new LoggingHandler("EchoServerUdp Handler 1", LogLevel.TRACE)); } }); }
From source file:org.opendaylight.usc.test.plugin.EchoServerTcp.java
License:Open Source License
public EchoServerTcp(final boolean enableEncryption, int port) { PORT = port;//from w w w.j a va 2 s .c o m UscConfigurationServiceImpl.setDefaultPropertyFilePath("src/test/resources/etc/usc/usc.properties"); secureService = UscServiceUtils.getService(UscSecureService.class); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 100) .handler(new LoggingHandler("EchoServerTcp server handler", LogLevel.TRACE)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); if (enableEncryption) { p.addLast(new LoggingHandler("EchoServerTcp Handler 3", LogLevel.TRACE)); p.addLast(secureService.getTcpServerHandler(ch)); } p.addLast(new LoggingHandler("EchoServerTcp Handler 2", LogLevel.TRACE)); p.addLast(new EchoServerTcpHandler()); p.addLast(new LoggingHandler("EchoServerTcp Handler 1", LogLevel.TRACE)); } }); }
From source file:org.opendaylight.usc.test.plugin.EchoServerUdp.java
License:Open Source License
public EchoServerUdp(final boolean enableEncryption, int port) { PORT = port;//w ww .j a v a2 s . co m UscConfigurationServiceImpl.setDefaultPropertyFilePath("src/test/resources/etc/usc/usc.properties"); secureService = UscServiceUtils.getService(UscSecureService.class); b.group(bossGroup).channel(NioDatagramChannel.class).handler(new ChannelInitializer<DatagramChannel>() { @Override public void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); if (enableEncryption) { p.addLast(new LoggingHandler("EchoServerUdp Handler 3", LogLevel.TRACE)); p.addLast(secureService.getUdpServerHandler(ch)); } p.addLast(new LoggingHandler("EchoServerUdp Handler 2", LogLevel.TRACE)); p.addLast(new EchoServerUdpHandler()); p.addLast(new LoggingHandler("EchoServerUdp Handler 1", LogLevel.TRACE)); } }); }
From source file:org.opendaylight.usc.test.plugin.UscPluginTest.java
License:Open Source License
/** * @throws java.lang.Exception// ww w .j av a 2 s .co m */ @Before public void setUp() throws Exception { UscConfigurationServiceImpl.setDefaultPropertyFilePath("src/test/resources/etc/usc/usc.properties"); /*Logger root = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); if (root instanceof SimpleLogger) { SimpleLogger.setLevel(SimpleLogger.TRACE); }*/ // set up client bootstrap clientBootstrap.group(localGroup); clientBootstrap.channel(LocalChannel.class); clientBootstrap.handler(new ChannelInitializer<LocalChannel>() { @Override public void initChannel(LocalChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new LoggingHandler("UscPluginTest client", LogLevel.TRACE)); // Decoders p.addLast("frameDecoder", new DelimiterBasedFrameDecoder(80, false, Delimiters.lineDelimiter())); p.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8)); // Encoder p.addLast("stringEncoder", new StringEncoder(CharsetUtil.UTF_8)); } }); }
From source file:org.opendaylight.usc.UscChannelServiceImpl.java
License:Open Source License
private Bootstrap getNewBootstrap() { Bootstrap ret = new Bootstrap(); EventLoopGroup localGroup = new LocalEventLoopGroup(); // set up client bootstrap ret.group(localGroup);/*from w w w.j a va 2s. c o m*/ ret.channel(LocalChannel.class); ret.handler(new ChannelInitializer<LocalChannel>() { @Override public void initChannel(LocalChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new LoggingHandler("Manager Test 1", LogLevel.TRACE)); } }); return ret; }
From source file:org.ow2.petals.bc.gateway.commons.handlers.AuthenticatorSSLHandler.java
License:Open Source License
private void setUpSslHandlers(final ChannelHandlerContext ctx, final AbstractDomain domain, final @Nullable String certificate, final @Nullable String key, final @Nullable String passphrase, final @Nullable String remoteCertificate) throws SSLException { // TODO could we use certificate only for auth and not encryption? // TODO support openssl final SslHandler sslHandler; if (pdOrAuth.isB() && certificate != null && key != null) { // server side ssl, do not forget startTls so that our accept can be sent after the handler is added final ServiceUnitDataHandler handler = domain.getSUHandler(); final SslContextBuilder builder = SslContextBuilder .forServer(ServiceUnitUtil.getFile(handler.getInstallRoot(), certificate), ServiceUnitUtil.getFile(handler.getInstallRoot(), key), passphrase) .sslProvider(SslProvider.JDK).ciphers(null, IdentityCipherSuiteFilter.INSTANCE) .sessionCacheSize(0).sessionTimeout(0); if (remoteCertificate != null) { builder.trustManager(ServiceUnitUtil.getFile(handler.getInstallRoot(), remoteCertificate)) .clientAuth(ClientAuth.REQUIRE); }/* ww w . java 2s. c o m*/ // until https://github.com/netty/netty/issues/5170 is accepted // we need to create the handler by hand sslHandler = new SslHandler(builder.build().newEngine(ctx.alloc()), true); } else if (pdOrAuth.isA() && remoteCertificate != null) { // client side final String installRoot = domain.getSUHandler().getInstallRoot(); final SslContextBuilder builder = SslContextBuilder.forClient().sslProvider(SslProvider.JDK) .trustManager(ServiceUnitUtil.getFile(installRoot, remoteCertificate)) .ciphers(null, IdentityCipherSuiteFilter.INSTANCE).sessionCacheSize(0).sessionTimeout(0); if (certificate != null && key != null) { builder.keyManager(ServiceUnitUtil.getFile(installRoot, certificate), ServiceUnitUtil.getFile(installRoot, key), passphrase); } sslHandler = builder.build().newHandler(ctx.alloc()); } else { sslHandler = null; } // For a server, it contains the transporter name and the consumer domain name (it was updated in channelRead0) // For a client, it contains the provider domain name (it was set by the component) final String logName = logger.getName(); // let's replace the debug logger with something specific to this consumer ctx.pipeline().replace(HandlerConstants.LOG_DEBUG_HANDLER, HandlerConstants.LOG_DEBUG_HANDLER, new LoggingHandler(logName, LogLevel.TRACE)); ctx.pipeline().replace(HandlerConstants.LOG_ERRORS_HANDLER, HandlerConstants.LOG_ERRORS_HANDLER, new LastLoggingHandler(logName + ".errors")); if (sslHandler != null) { // if there is a sslHandler, then we can only add the domain handler after the handshake is finished // if not we risk sending things too early in it sslHandler.handshakeFuture().addListener(new FutureListener<Channel>() { @Override public void operationComplete(final @Nullable Future<Channel> future) throws Exception { assert future != null; if (!future.isSuccess()) { authenticationFuture.setFailure(future.cause()); } else { // I must keep the handler here until now in case there is an exception so that I can log it ctx.pipeline().replace(HandlerConstants.DOMAIN_HANDLER, HandlerConstants.DOMAIN_HANDLER, dhb.build(domain)); authenticationFuture.setSuccess(ctx.channel()); } } }); ctx.pipeline().addAfter(HandlerConstants.LOG_DEBUG_HANDLER, HandlerConstants.SSL_HANDLER, sslHandler); } if (pdOrAuth.isB()) { if (logger.isLoggable(Level.FINE)) { logger.fine("Sending an Accept (" + ctx.channel().remoteAddress() + ")"); } // this must be sent after the ssh handler is replaced (when using ssl) so that we are ready to receive ssl data right away // but this must be sent before the domain handler is replaced (when not using ssl), because it will send // data and it must arrive AFTER our Accept ctx.writeAndFlush(new AuthAccept()); } // else it is done in the FutureListener if (sslHandler == null) { ctx.pipeline().replace(HandlerConstants.DOMAIN_HANDLER, HandlerConstants.DOMAIN_HANDLER, dhb.build(domain)); authenticationFuture.setSuccess(ctx.channel()); } }
From source file:org.ow2.petals.bc.gateway.inbound.TransportListener.java
License:Open Source License
public TransportListener(final JbiTransportListener jtl, final ServerBootstrap partialBootstrap, final Logger logger, final ClassResolver cr) { this.jtl = jtl; this.logger = logger; // shared between all the connections of this listener final LoggingHandler debugs = new LoggingHandler(logger.getName() + ".dispatcher", LogLevel.TRACE); final ChannelHandler errors = new LastLoggingHandler(logger.getName() + ".errors"); final ObjectEncoder objectEncoder = new ObjectEncoder(); final ServerBootstrap _bootstrap = partialBootstrap .handler(new LoggingHandler(logger.getName() + ".listener")) .childHandler(new ChannelInitializer<Channel>() { @Override// ww w. j a va 2s .c o m protected void initChannel(final @Nullable Channel ch) throws Exception { assert ch != null; final ChannelPipeline p = ch.pipeline(); p.addLast(HandlerConstants.LOG_DEBUG_HANDLER, debugs); p.addLast(objectEncoder); p.addLast(new ObjectDecoder(cr)); p.addLast(HandlerConstants.DOMAIN_HANDLER, new AuthenticatorSSLHandler( TransportListener.this, logger, new DomainHandlerBuilder<ConsumerDomain>() { @Override public ChannelHandler build(final ConsumerDomain domain) { return new DomainHandler(domain); } })); p.addLast(HandlerConstants.LOG_ERRORS_HANDLER, errors); } }); assert _bootstrap != null; bootstrap = _bootstrap; }