當前位置: 首頁>>代碼示例>>Java>>正文


Java InternalLoggerFactory類代碼示例

本文整理匯總了Java中io.netty.util.internal.logging.InternalLoggerFactory的典型用法代碼示例。如果您正苦於以下問題:Java InternalLoggerFactory類的具體用法?Java InternalLoggerFactory怎麽用?Java InternalLoggerFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InternalLoggerFactory類屬於io.netty.util.internal.logging包,在下文中一共展示了InternalLoggerFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logMethodCall

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public static void logMethodCall(Object object, String methodName, Object[] arguments) {
    String className = getClassName(object);
    String logname = "methodCalls." + className + "." + methodName;
    InternalLogger objLog = InternalLoggerFactory.getInstance(logname);
    if (!objLog.isTraceEnabled()) return;
    StringBuilder msg = new StringBuilder(methodName);
    msg.append("(");
    if (arguments != null) {
        for (int i = 0; i < arguments.length;) {
            msg.append(normalizedValue(arguments[i]));
            if (++i < arguments.length) {
                msg.append(",");
            }
        }
    }
    msg.append(")");
    objLog.log(InternalLogLevel.TRACE, className, msg.toString(), "called from MetaClass.invokeMethod");
}
 
開發者ID:yajsw,項目名稱:yajsw,代碼行數:19,代碼來源:MetaClassHelper.java

示例2: init

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
/**
 * Init timeouts and the connection registry and start the netty IO server synchronously
 */
@Override
public void init(Container container) {
    super.init(container);
    try {
        // Configure netty
        InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory() {
            @Override
            public InternalLogger newInstance(String name) {
                return new NettyInternalLogger(name);
            }
        });
        ResourceLeakDetector.setLevel(CoreConstants.NettyConstants.RESOURCE_LEAK_DETECTION);
        // Start server
        startServer();
    } catch (InterruptedException e) {
        throw new StartupException("Could not start netty server", e);
    }
}
 
開發者ID:SecureSmartHome,項目名稱:SecureSmartHome,代碼行數:22,代碼來源:Server.java

示例3: init

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
/**
 * Configure netty and initialize related Components.
 * Afterwards call {@link #initClient()} method to start the netty IO client asynchronously.
 */
@Override
public void init(Container container) {
    super.init(container);
    // Configure netty
    InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory() {
        @Override
        public InternalLogger newInstance(String name) {
            return new NettyInternalLogger(name);
        }
    });
    ResourceLeakDetector.setLevel(CoreConstants.NettyConstants.RESOURCE_LEAK_DETECTION);
    // And try to connect
    isActive = true;
    initClient();
    // register BroadcastListener
    IntentFilter filter = new IntentFilter();
    filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
    filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
    filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    requireComponent(ContainerService.KEY_CONTEXT).registerReceiver(broadcastReceiver, filter);
}
 
開發者ID:SecureSmartHome,項目名稱:SecureSmartHome,代碼行數:27,代碼來源:Client.java

示例4: main

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
/**
 * Main entry point
 * @param args None for now
 */
public static void main(String[] args) {
	log.info("TSDBLite booting....");	
	ExtendedThreadManager.install();
	InternalLoggerFactory .setDefaultFactory(Slf4JLoggerFactory.INSTANCE);		
	final String jmxmpIface = ConfigurationHelper.getSystemThenEnvProperty(Constants.CONF_JMXMP_IFACE, Constants.DEFAULT_JMXMP_IFACE);
	final int jmxmpPort = ConfigurationHelper.getIntSystemThenEnvProperty(Constants.CONF_JMXMP_PORT, Constants.DEFAULT_JMXMP_PORT);
	JMXHelper.fireUpJMXMPServer(jmxmpIface, jmxmpPort, JMXHelper.getHeliosMBeanServer());
	server = Server.getInstance();
	final Thread mainThread = Thread.currentThread();
	StdInCommandHandler.getInstance().registerCommand("stop", new Runnable(){
		@Override
		public void run() {
			if(server!=null) {
				log.info("Stopping TSDBLite Server.....");
				server.stop();
				log.info("TSDBLite Server Stopped. Bye.");
				mainThread.interrupt();
			}
		}
	});
	try { Thread.currentThread().join(); } catch (Exception x) {/* No Op */}
}
 
開發者ID:nickman,項目名稱:tsdblite,代碼行數:27,代碼來源:TSDBLite.java

示例5: retain

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public void retain() {

            if (counter.incrementAndGet() == 1) {

                if (instanceCounter.getAndIncrement() > 0) {
                    InternalLogger instance = InternalLoggerFactory.getInstance(getClass());
                    instance.info("Initialized PauseDetectorWrapper more than once.");
                }

                pauseDetector = new SimplePauseDetector(TimeUnit.MILLISECONDS.toNanos(10), TimeUnit.MILLISECONDS.toNanos(10), 3);
                Runtime.getRuntime().addShutdownHook(new Thread("ShutdownHook for SimplePauseDetector") {
                    @Override
                    public void run() {
                        if (pauseDetector != null) {
                            pauseDetector.shutdown();
                        }
                    }
                });
            }
        }
 
開發者ID:lettuce-io,項目名稱:lettuce-core,代碼行數:21,代碼來源:DefaultCommandLatencyCollector.java

示例6: init

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public void init(Container container, ServerBundleConfiguration config) {
	logger.info("Initializing the container");
	// Override the supplied one
	ServerConfiguration configuration = container.getConfiguration().getServerConfiguration();
	AbstractHttpConnector connector = null;
	
	InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
	
	logger.info("Loading the http connectors");
	for (ConnectorConfiguration connectorConfig : configuration.getConnectorConfigurations()) {
		if (connectorConfig.getScheme() == Scheme.https) {
			connector = createHttpsConnector(connectorConfig, container.getRouter());
		} else {
			connector = createHttpConnector(connectorConfig, container.getRouter());
		}
		connector.registerListener(container.getMessageObserver());
		connector.initialize();
		connectors.add(connector);
	}
}
 
開發者ID:minnal,項目名稱:minnal,代碼行數:21,代碼來源:Server.java

示例7: start

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public void start() {
    Configuration config = Configuration.INSTANCE;
    InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
    bossGroup = new NioEventLoopGroup(1);
    workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(bossGroup, workerGroup)
                .channel(NioServerSocketChannel.class)
                .childHandler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    protected void initChannel(SocketChannel socketChannel) throws Exception {
                        socketChannel.pipeline()
                                .addLast("logging", new LoggingHandler(LogLevel.DEBUG))
                                .addLast(new SocksInitRequestDecoder())
                                .addLast(new SocksMessageEncoder())
                                .addLast(new Socks5Handler())
                                .addLast(Status.TRAFFIC_HANDLER);
                    }
                });
        log.info("\tStartup {}-{}-client [{}{}]", Constants.APP_NAME, Constants.APP_VERSION, config.getMode(), config.getMode().equals("socks5") ? "" : ":" + config.getProtocol());
        new Thread(() -> new UdpServer().start()).start();
        ChannelFuture future = bootstrap.bind(config.getLocalHost(), config.getLocalPort()).sync();
        future.addListener(future1 -> log.info("\tTCP listening at {}:{}...", config.getLocalHost(), config.getLocalPort()));
        future.channel().closeFuture().sync();
    } catch (Exception e) {
        log.error("\tSocket bind failure ({})", e.getMessage());
    } finally {
        log.info("\tShutting down");
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}
 
開發者ID:ZhangJiupeng,項目名稱:AgentX,代碼行數:34,代碼來源:XClient.java

示例8: start

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public void start() {
    Configuration config = Configuration.INSTANCE;
    InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
    EventLoopGroup bossGroup = new NioEventLoopGroup(1);
    EventLoopGroup workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(bossGroup, workerGroup)
                .channel(NioServerSocketChannel.class)
                .childHandler(new ChannelInitializer<SocketChannel>() {
                    protected void initChannel(SocketChannel socketChannel) throws Exception {
                        socketChannel.pipeline()
                                .addLast("logging", new LoggingHandler(LogLevel.DEBUG))
                                .addLast(new XConnectHandler());
                        if (config.getReadLimit() != 0 || config.getWriteLimit() != 0) {
                            socketChannel.pipeline().addLast(
                                    new GlobalTrafficShapingHandler(Executors.newScheduledThreadPool(1), config.getWriteLimit(), config.getReadLimit())
                            );
                        }
                    }
                });
        log.info("\tStartup {}-{}-server [{}]", Constants.APP_NAME, Constants.APP_VERSION, config.getProtocol());
        new Thread(() -> new UdpServer().start()).start();
        ChannelFuture future = bootstrap.bind(config.getHost(), config.getPort()).sync();
        future.addListener(future1 -> log.info("\tTCP listening at {}:{}...", config.getHost(), config.getPort()));
        future.channel().closeFuture().sync();
    } catch (Exception e) {
        log.error("\tSocket bind failure ({})", e.getMessage());
    } finally {
        log.info("\tShutting down and recycling...");
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
        Configuration.shutdownRelays();
    }
    System.exit(0);
}
 
開發者ID:ZhangJiupeng,項目名稱:AgentX,代碼行數:37,代碼來源:XServer.java

示例9: setAhessianLogger

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public static void setAhessianLogger(final Logger log)
{
	InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory()
	{

		@Override
		public InternalLogger newInstance(String name)
		{
			return (InternalLogger) new JdkLogger(log, "ahessian-jmx");
		}
	});
}
 
開發者ID:yajsw,項目名稱:yajsw,代碼行數:13,代碼來源:AhessianLogging.java

示例10: start

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
/**
 * Starts the server.
 * @throws InterruptedException
 */
public static void start() {
	InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
	EventLoopGroup group = new NioEventLoopGroup();
	try {
		Bootstrap boot = new Bootstrap();
		boot.group(group)
		.channel(NioSocketChannel.class)
		.handler(new ChannelInitializer<SocketChannel>() {
			@Override
			public void initChannel(SocketChannel ch) throws Exception {
				ch.pipeline().addLast(new SortClientInitializer());
			}
		});
		LOG.info("Client connecting to {}:{}", ClientMain.SERVER_ADDRESS, ClientMain.SERVER_PORT);
		// Start the client.
		ChannelFuture f = boot.connect(new InetSocketAddress(ClientMain.SERVER_ADDRESS, ClientMain.SERVER_PORT)).sync();			
		// Wait until the connection is closed.
		f.channel().closeFuture().sync();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		// The connection is closed automatically on shutdown.
		group.shutdownGracefully();
		LOG.info("Client Exit.");
	}
}
 
開發者ID:map-reduce-ka-tadka,項目名稱:slim-map-reduce,代碼行數:31,代碼來源:SortClient.java

示例11: start

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
/**
 * Starts the server.
 * @throws InterruptedException
 */
public static void start() throws InterruptedException {
	InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
	// configure the server
	EventLoopGroup bossGroup = new NioEventLoopGroup(1);
	EventLoopGroup workerGroup = new NioEventLoopGroup();
	try {
		ServerBootstrap boot = new ServerBootstrap();
		boot.group(bossGroup, workerGroup)
		.channel(NioServerSocketChannel.class)
		.childHandler(new ChannelInitializer<SocketChannel>() {
			@Override
			public void initChannel(SocketChannel sChannel) throws Exception {
				sChannel.pipeline().addLast(new SortServerInitializer());
			}
		})
		.option(ChannelOption.SO_BACKLOG, 128)
		.childOption(ChannelOption.SO_KEEPALIVE, true)
		.childOption(ChannelOption.TCP_NODELAY, true);
		// Start the server.
		ChannelFuture f = boot.bind(new InetSocketAddress(ServerMain.SERVER_ADDRESS, ServerMain.SERVER_PORT)).sync();
		LOG.info("Server started at {}:{}, JobId: {}", ServerMain.SERVER_ADDRESS, ServerMain.SERVER_PORT, ServerMain.JOB_ID);
		// Wait until the server socket is closed.
		f.channel().closeFuture().sync();			
	} 
	catch (Exception e) {
		e.printStackTrace();
	} 
	finally {			
		// Shut down all event loops to terminate all threads.
		bossGroup.shutdownGracefully();
		workerGroup.shutdownGracefully();
		// Wait until all threads are terminated.
		bossGroup.terminationFuture().sync();
		workerGroup.terminationFuture().sync();
		LOG.info("Server Exit.");
	}
}
 
開發者ID:map-reduce-ka-tadka,項目名稱:slim-map-reduce,代碼行數:42,代碼來源:SortServer.java

示例12: PravegaConnectionListener

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
/**
 * Creates a new instance of the PravegaConnectionListener class.
 *
 * @param ssl                Whether to use SSL.
 * @param host               The name of the host to listen to.
 * @param port               The port to listen on.
 * @param streamSegmentStore The SegmentStore to delegate all requests to.
 * @param statsRecorder      (Optional) A StatsRecorder for Metrics.
 */
public PravegaConnectionListener(boolean ssl, String host, int port, StreamSegmentStore streamSegmentStore,
                                 SegmentStatsRecorder statsRecorder) {
    this.ssl = ssl;
    this.host = Exceptions.checkNotNullOrEmpty(host, "host");
    this.port = port;
    this.store = Preconditions.checkNotNull(streamSegmentStore, "streamSegmentStore");
    this.statsRecorder = statsRecorder;
    InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
}
 
開發者ID:pravega,項目名稱:pravega,代碼行數:19,代碼來源:PravegaConnectionListener.java

示例13: setup

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
@Before
public void setup() throws Exception {
    originalLevel = ResourceLeakDetector.getLevel();
    ResourceLeakDetector.setLevel(Level.PARANOID);
    InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
    this.serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    this.serviceBuilder.initialize();
}
 
開發者ID:pravega,項目名稱:pravega,代碼行數:9,代碼來源:TransactionTest.java

示例14: SpdyFrameLogger

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
public SpdyFrameLogger(InternalLogLevel level) {
    if (level == null) {
        throw new NullPointerException("level");
    }

    logger = InternalLoggerFactory.getInstance(getClass());
    this.level = level;
}
 
開發者ID:cowthan,項目名稱:JavaAyo,代碼行數:9,代碼來源:SpdyFrameLogger.java

示例15: serverBootstrapFactory

import io.netty.util.internal.logging.InternalLoggerFactory; //導入依賴的package包/類
@Bean
@Resource(name = "channelInitializer")
public ServerBootstrap serverBootstrapFactory(ChannelInitializer<SocketChannel> channelInitializer) {
	// 配置服務器
	EventLoopGroup bossGroup = new NioEventLoopGroup();
	EventLoopGroup workerGroup = new NioEventLoopGroup();
	InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
	ServerBootstrap serverBootstrap = new ServerBootstrap();
	serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
			.handler(new LoggingHandler(LogLevel.INFO)).childHandler(channelInitializer)
			.option(ChannelOption.SO_BACKLOG, 128).childOption(ChannelOption.SO_KEEPALIVE, true);

	return serverBootstrap;
}
 
開發者ID:bleast,項目名稱:netty-http-server,代碼行數:15,代碼來源:ServerConfig.java


注:本文中的io.netty.util.internal.logging.InternalLoggerFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。