List of usage examples for io.netty.handler.logging LogLevel INFO
LogLevel INFO
To view the source code for io.netty.handler.logging LogLevel INFO.
Click Source Link
From source file:me.zhuoran.amoeba.netty.server.HttpServerInitializer.java
License:Apache License
public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline();//from w ww . j a v a 2 s .c o m p.addLast("logger", new LoggingHandler(LogLevel.INFO)); p.addLast("http-decoder", new HttpRequestDecoder()); p.addLast("http-aggregator", new HttpObjectAggregator(this.maxContentLength)); p.addLast("codec", new HttpServerCodec()); p.addLast("handler", new HttpRequestHandler()); }
From source file:net.bafeimao.umbrella.servers.world.WorldServer.java
License:Apache License
@Override public void onStarting() { ServerInfo serverInfo = getServerInfo(); // ?Socket?//from w w w . j a va2 s . c o m SocketServerBuilder.newBuilder().forAddress(serverInfo.getHost(), serverInfo.getPort()) .handlerPackageScan("net.bafeimao.umbrella") .setEventLoopThreads(1, Runtime.getRuntime().availableProcessors() * 2).setLogLevel(LogLevel.INFO) .build().start(); // ?RPC? }
From source file:net.hasor.rsf.console.RsfConsoleModule.java
License:Apache License
@Override public void onStart(AppContext appContext) throws Throwable { RsfContext rsfContext = appContext.getInstance(RsfContext.class); if (rsfContext == null) { logger.error("rsfConsole -> RsfContext is null."); return;/*from www . ja v a 2 s . c om*/ } //1.??? this.workerGroup = new NioEventLoopGroup(1, new NameThreadFactory("RSF-Console", appContext.getClassLoader())); this.telnetHandler = new TelnetHandler(rsfContext); int consolePort = rsfContext.getSettings().getConsolePort(); String consoleAddress = rsfContext.getSettings().getBindAddress(); String formUnit = rsfContext.getSettings().getUnitName(); try { this.bindAddress = new InterAddress(consoleAddress, consolePort, formUnit); } catch (Throwable e) { throw new UnknownHostException(e.getMessage()); } logger.info("rsfConsole -> starting... at {}", this.bindAddress); // //2.?Telnet try { ServerBootstrap b = new ServerBootstrap(); b.group(workerGroup, workerGroup); b.channel(NioServerSocketChannel.class); b.handler(new LoggingHandler(LogLevel.INFO)); b.childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter())); pipeline.addLast(stringDecoder); pipeline.addLast(stringEncoder); pipeline.addLast(telnetHandler); } }); b.bind(this.bindAddress.getHost(), this.bindAddress.getPort()).sync().await(); } catch (Throwable e) { logger.error("rsfConsole -> start failed, " + e.getMessage(), e); this.shutdown(); } logger.info("rsfConsole -> - bindSocket at {}", this.bindAddress); // //3.shutdown??shutdown??Telnet Hasor.addShutdownListener(rsfContext.getEnvironment(), new EventListener<AppContext>() { @Override public void onEvent(String event, AppContext eventData) throws Throwable { shutdown(); } }); }
From source file:net.ieldor.Main.java
License:Open Source License
/** * Initates a new gaming enviroment, here we are going to setup everything * needed for the server to be able to bind. *///from w w w .j av a2s .c om private void initate() { bootstrap = new ServerBootstrap(); bootstrap.group(new NioEventLoopGroup(), new NioEventLoopGroup()); bootstrap.channel(NioServerSocketChannel.class); bootstrap.option(ChannelOption.SO_BACKLOG, 100); bootstrap.childOption(ChannelOption.TCP_NODELAY, true); bootstrap.handler(new LoggingHandler(LogLevel.INFO)); bootstrap.childHandler(new ChannelChildHandler(this)); try { bootstrap.localAddress(43594).bind().sync(); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.NettyEngine4.file.HttpStaticFileServer.java
License:Apache License
public static void main(String[] args) throws Exception { PropertyConfigurator.configure(Config.DEFAULT_VALUE.FILE_PATH.LOG4J); // Configure SSL. final SslContext sslCtx; if (SSL) {//from w w w . j a v a 2 s.co m SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContext.newServerContext(SslProvider.JDK, ssc.certificate(), ssc.privateKey()); } else { sslCtx = null; } EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new HttpStaticFileServerInitializer(sslCtx)); Channel ch = b.bind(PORT).sync().channel(); LOGGER.debug("Open your web browser and navigate to " + (SSL ? "https" : "http") + "://127.0.0.1:" + PORT + '/'); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:net.oebs.jalos.netty.HttpServer.java
License:Open Source License
public void run() throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try {/* w w w .j av a 2 s . c om*/ ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_BACKLOG, 8192); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)).childHandler(new HttpInitializer()); Channel ch = b.bind(host, port).sync().channel(); log.info("Listening at http://{}:{}/", host, port); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:net.smert.frameworkgl.Network.java
License:Apache License
public Network() { keepAlive = true; tcpNoDelay = true; backlog = 128; serverPort = 0; logLevel = LogLevel.INFO; }
From source file:net.smert.frameworkgl.Network.java
License:Apache License
public void setLogLevelInfo() { this.logLevel = LogLevel.INFO; }
From source file:net.yuntutv.a8.ws.WebSocketServer.java
License:Apache License
public static void main(String[] args) throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try {/*from w w w .j av a 2 s .c o m*/ ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)).childHandler(new WebSocketServerInitializer()); Channel ch = b.bind(PORT).sync().channel(); System.out.println("Open your web browser and navigate to http://127.0.0.1:" + PORT + '/'); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:Netty.BeaconServer.java
License:Apache License
public void run() { //public static void main(String[] args) throws Exception { try {// w ww . j a v a 2s .c om // Configure SSL. final SslContext sslCtx; if (SSL) { SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContext.newServerContext(ssc.certificate(), ssc.privateKey()); } else { sslCtx = null; } EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new BeaconServerInitializer(sslCtx, file)); b.bind(PORT).sync().channel().closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } catch (Exception e) { System.out.println("Error in BeaconServer"); System.out.println(e.getMessage()); } }