Example usage for io.netty.util.internal.logging InternalLoggerFactory getDefaultFactory

List of usage examples for io.netty.util.internal.logging InternalLoggerFactory getDefaultFactory

Introduction

In this page you can find the example usage for io.netty.util.internal.logging InternalLoggerFactory getDefaultFactory.

Prototype

public static InternalLoggerFactory getDefaultFactory() 

Source Link

Document

Returns the default factory.

Usage

From source file:com.alibaba.dubbo.remoting.transport.netty.logging.NettyHelper.java

License:Apache License

public static void setNettyLoggerFactory() {
    InternalLoggerFactory factory = InternalLoggerFactory.getDefaultFactory();
    if (factory == null || !(factory instanceof DubboLoggerFactory)) {
        InternalLoggerFactory.setDefaultFactory(new DubboLoggerFactory());
    }//  w  ww. j  a v  a2  s  .com
}

From source file:io.vertx.test.core.DatagramTest.java

License:Open Source License

private TestLoggerFactory testLogging(DatagramSocketOptions sendOptions, DatagramSocketOptions listenOptions)
        throws Exception {
    InternalLoggerFactory prev = InternalLoggerFactory.getDefaultFactory();
    TestLoggerFactory factory = new TestLoggerFactory();
    InternalLoggerFactory.setDefaultFactory(factory);
    try {/*  w ww  .ja  va  2 s .  c  om*/
        peer1 = vertx.createDatagramSocket(sendOptions);
        peer2 = vertx.createDatagramSocket(listenOptions);
        peer2.exceptionHandler(t -> fail(t.getMessage()));
        peer2.listen(1234, "127.0.0.1", ar -> {
            assertTrue(ar.succeeded());
            Buffer buffer = TestUtils.randomBuffer(128);
            peer2.handler(packet -> {
                assertEquals(buffer, packet.data());
                testComplete();
            });
            peer1.send(buffer, 1234, "127.0.0.1", ar2 -> assertTrue(ar2.succeeded()));
        });
        await();
    } finally {
        InternalLoggerFactory.setDefaultFactory(prev);
    }
    return factory;
}

From source file:io.vertx.test.core.HttpTest.java

License:Open Source License

private TestLoggerFactory testLogging() throws Exception {
    InternalLoggerFactory prev = InternalLoggerFactory.getDefaultFactory();
    TestLoggerFactory factory = new TestLoggerFactory();
    InternalLoggerFactory.setDefaultFactory(factory);
    try {/*from  ww w .  j  a va2s . c o  m*/
        server.requestHandler(req -> {
            req.response().end();
        });
        startServer();
        client.getNow(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/somepath", resp -> {
            testComplete();
        });
        await();
    } finally {
        InternalLoggerFactory.setDefaultFactory(prev);
    }
    return factory;
}

From source file:io.vertx.test.core.NetTest.java

License:Open Source License

private TestLoggerFactory testLogging() throws Exception {
    InternalLoggerFactory prev = InternalLoggerFactory.getDefaultFactory();
    TestLoggerFactory factory = new TestLoggerFactory();
    InternalLoggerFactory.setDefaultFactory(factory);
    try {//w  ww.j  av a  2  s  . co  m
        server.connectHandler(so -> {
            so.write("fizzbuzz").end();
        });
        server.listen(1234, "localhost", onSuccess(v1 -> {
            client.connect(1234, "localhost", onSuccess(so -> {
                so.closeHandler(v2 -> testComplete());
            }));
        }));
        await();
    } finally {
        InternalLoggerFactory.setDefaultFactory(prev);
    }
    return factory;
}

From source file:pub.vrtech.monkey.transport.netty.NettyHelper.java

License:Apache License

public static void setNettyLoggerFactory() {
    InternalLoggerFactory factory = InternalLoggerFactory.getDefaultFactory();
    if (factory == null || !(factory instanceof MonkeyLoggerFactory)) {
        InternalLoggerFactory.setDefaultFactory(new MonkeyLoggerFactory());
    }/*from   w  ww. j  a v  a2 s .  c  o  m*/
}