Search in sources :

Example 1 with Logger

use of com.firenio.log.Logger in project baseio by generallycloud.

the class TestLog method testSl4J.

static void testSl4J() {
    Logger logger = LoggerFactory.getLogger(TestLog.class);
    for (int i = 0; i < 1000000; i++) {
        logger.info("logback info 成功了..............................................");
        logger.error("logback error 成功了..............................................");
        logger.debug("logback debug 成功了..............................................");
    }
}
Also used : Logger(com.firenio.log.Logger)

Example 2 with Logger

use of com.firenio.log.Logger in project baseio by generallycloud.

the class TestLoadClient method main.

public static void main(String[] args) throws Exception {
    final Logger logger = LoggerFactory.getLogger(TestLoadClient.class);
    final CountDownLatch latch = new CountDownLatch(time);
    final AtomicInteger res = new AtomicInteger();
    final AtomicInteger req = new AtomicInteger();
    IoEventHandle eventHandleAdaptor = new IoEventHandle() {

        @Override
        public void accept(Channel ch, Frame frame) throws Exception {
        // latch.countDown();
        // long count = latch.getCount();
        // if (count % 10 == 0) {
        // if (count < 50) {
        // logger.info("************************================" + count);
        // }
        // }
        // logger.info("res==========={}",res.getAndIncrement());
        }
    };
    ChannelConnector context = new ChannelConnector(8300);
    context.setIoEventHandle(eventHandleAdaptor);
    context.addChannelEventListener(new LoggerChannelOpenListener());
    context.addProtocolCodec(new LengthValueCodec());
    Channel ch = context.connect();
    System.out.println("################## Test start ####################");
    long old = Util.now();
    for (int i = 0; i < time; i++) {
        LengthValueFrame frame = new LengthValueFrame();
        frame.write("hello server!", ch);
        ch.writeAndFlush(frame);
    }
    latch.await();
    long spend = (Util.past(old));
    System.out.println("## Execute Time:" + time);
    System.out.println("## OP/S:" + new BigDecimal(time * 1000).divide(new BigDecimal(spend), 2, BigDecimal.ROUND_HALF_UP));
    System.out.println("## Expend Time:" + spend);
    Util.close(context);
}
Also used : IoEventHandle(com.firenio.component.IoEventHandle) LengthValueFrame(com.firenio.codec.lengthvalue.LengthValueFrame) Frame(com.firenio.component.Frame) Channel(com.firenio.component.Channel) LengthValueFrame(com.firenio.codec.lengthvalue.LengthValueFrame) Logger(com.firenio.log.Logger) CountDownLatch(java.util.concurrent.CountDownLatch) BigDecimal(java.math.BigDecimal) LoggerChannelOpenListener(com.firenio.component.LoggerChannelOpenListener) LengthValueCodec(com.firenio.codec.lengthvalue.LengthValueCodec) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ChannelConnector(com.firenio.component.ChannelConnector)

Example 3 with Logger

use of com.firenio.log.Logger in project baseio by generallycloud.

the class TestLog method testInternalLogger.

static void testInternalLogger() throws IOException {
    LoggerFactory.setEnableSLF4JLogger(false);
    LoggerFactory.setInternalLogFile(new File("D://test/main.log"));
    Logger logger = LoggerFactory.getLogger(TestLog.class);
    for (int i = 0; i < 1000; i++) {
        logger.info("logback info 成功了..............................................");
        logger.error("logback error 成功了..............................................");
        logger.debug("logback debug 成功了..............................................");
    }
}
Also used : Logger(com.firenio.log.Logger) File(java.io.File)

Example 4 with Logger

use of com.firenio.log.Logger in project baseio by generallycloud.

the class TestLogger method main.

public static void main(String[] args) {
    LoggerFactory.setEnableSLF4JLogger(false);
    Logger logger = LoggerFactory.getLogger(TestLogger.class);
    for (int i = 0; i < 10; i++) {
        logger.debug("debug test..........");
        logger.info("info test..............");
        logger.error("error test......");
    }
}
Also used : Logger(com.firenio.log.Logger)

Aggregations

Logger (com.firenio.log.Logger)4 LengthValueCodec (com.firenio.codec.lengthvalue.LengthValueCodec)1 LengthValueFrame (com.firenio.codec.lengthvalue.LengthValueFrame)1 Channel (com.firenio.component.Channel)1 ChannelConnector (com.firenio.component.ChannelConnector)1 Frame (com.firenio.component.Frame)1 IoEventHandle (com.firenio.component.IoEventHandle)1 LoggerChannelOpenListener (com.firenio.component.LoggerChannelOpenListener)1 File (java.io.File)1 BigDecimal (java.math.BigDecimal)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1