org.apache.rocketmq.logging.InternalLogger Java Examples

The following examples show how to use org.apache.rocketmq.logging.InternalLogger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientLogger.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
/**
 * 创建Logger
 * @param loggerName loggerName
 * @return ;
 */
private static InternalLogger createLogger(final String loggerName) {
    String clientLogLevel = System.getProperty(CLIENT_LOG_LEVEL, "INFO");
    boolean additive = "true".equalsIgnoreCase(System.getProperty(CLIENT_LOG_ADDITIVE));
    InternalLogger logger = InternalLoggerFactory.getLogger(loggerName);
    InnerLoggerFactory.InnerLogger innerLogger = (InnerLoggerFactory.InnerLogger) logger;
    Logger realLogger = innerLogger.getLogger();

    if (rocketmqClientAppender == null) {
        createClientAppender();
    }

    realLogger.addAppender(rocketmqClientAppender);
    realLogger.setLevel(Level.toLevel(clientLogLevel));
    realLogger.setAdditivity(additive);
    return logger;
}
 
Example #2
Source File: DefaultRequestProcessorTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Before
public void init() throws Exception {
    namesrvConfig = new NamesrvConfig();
    nettyServerConfig = new NettyServerConfig();
    routeInfoManager = new RouteInfoManager();

    namesrvController = new NamesrvController(namesrvConfig, nettyServerConfig);

    Field field = NamesrvController.class.getDeclaredField("routeInfoManager");
    field.setAccessible(true);
    field.set(namesrvController, routeInfoManager);
    defaultRequestProcessor = new DefaultRequestProcessor(namesrvController);

    registerRouteInfoManager();

    logger = mock(InternalLogger.class);
    setFinalStatic(DefaultRequestProcessor.class.getDeclaredField("log"), logger);
}
 
Example #3
Source File: ClientLogger.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
private static InternalLogger createLogger(final String loggerName) {
    String clientLogLevel = System.getProperty(CLIENT_LOG_LEVEL, "INFO");
    boolean additive = "true".equalsIgnoreCase(System.getProperty(CLIENT_LOG_ADDITIVE));
    InternalLogger logger = InternalLoggerFactory.getLogger(loggerName);
    InnerLoggerFactory.InnerLogger innerLogger = (InnerLoggerFactory.InnerLogger) logger;
    Logger realLogger = innerLogger.getLogger();

    if (rocketmqClientAppender == null) {
        createClientAppender();
    }

    realLogger.addAppender(rocketmqClientAppender);
    realLogger.setLevel(Level.toLevel(clientLogLevel));
    realLogger.setAdditivity(additive);
    return logger;
}
 
Example #4
Source File: DefaultRequestProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() throws Exception {
    namesrvConfig = new NamesrvConfig();
    nettyServerConfig = new NettyServerConfig();
    routeInfoManager = new RouteInfoManager();

    namesrvController = new NamesrvController(namesrvConfig, nettyServerConfig);

    Field field = NamesrvController.class.getDeclaredField("routeInfoManager");
    field.setAccessible(true);
    field.set(namesrvController, routeInfoManager);
    defaultRequestProcessor = new DefaultRequestProcessor(namesrvController);

    registerRouteInfoManager();

    logger = mock(InternalLogger.class);
    setFinalStatic(DefaultRequestProcessor.class.getDeclaredField("log"), logger);
}
 
Example #5
Source File: DefaultRequestProcessorTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Before
public void init() throws Exception {
    namesrvConfig = new NamesrvConfig();
    nettyServerConfig = new NettyServerConfig();
    routeInfoManager = new RouteInfoManager();

    namesrvController = new NamesrvController(namesrvConfig, nettyServerConfig);

    Field field = NamesrvController.class.getDeclaredField("routeInfoManager");
    field.setAccessible(true);
    field.set(namesrvController, routeInfoManager);
    defaultRequestProcessor = new DefaultRequestProcessor(namesrvController);

    registerRouteInfoManager();

    logger = mock(InternalLogger.class);
    setFinalStatic(DefaultRequestProcessor.class.getDeclaredField("log"), logger);
}
 
Example #6
Source File: ClientLogger.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private static InternalLogger createLogger(final String loggerName) {
    String clientLogLevel = System.getProperty(CLIENT_LOG_LEVEL, "INFO");
    boolean additive = "true".equalsIgnoreCase(System.getProperty(CLIENT_LOG_ADDITIVE));
    InternalLogger logger = InternalLoggerFactory.getLogger(loggerName);
    InnerLoggerFactory.InnerLogger innerLogger = (InnerLoggerFactory.InnerLogger) logger;
    Logger realLogger = innerLogger.getLogger();

    //if (rocketmqClientAppender == null) {
    //   createClientAppender();
    //}

    realLogger.addAppender(new AppenderProxy());
    realLogger.setLevel(Level.toLevel(clientLogLevel));
    realLogger.setAdditivity(additive);
    return logger;
}
 
Example #7
Source File: MQHelper.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * Reset consumer topic offset according to time
 *
 * @param messageModel which model
 * @param instanceName which instance
 * @param consumerGroup consumer group
 * @param topic topic
 * @param timestamp time
 */
public static void resetOffsetByTimestamp(
    final MessageModel messageModel,
    final String instanceName,
    final String consumerGroup,
    final String topic,
    final long timestamp) throws Exception {
    final InternalLogger log = ClientLogger.getLog();

    DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(consumerGroup);
    consumer.setInstanceName(instanceName);
    consumer.setMessageModel(messageModel);
    consumer.start();

    Set<MessageQueue> mqs = null;
    try {
        mqs = consumer.fetchSubscribeMessageQueues(topic);
        if (mqs != null && !mqs.isEmpty()) {
            TreeSet<MessageQueue> mqsNew = new TreeSet<MessageQueue>(mqs);
            for (MessageQueue mq : mqsNew) {
                long offset = consumer.searchOffset(mq, timestamp);
                if (offset >= 0) {
                    consumer.updateConsumeOffset(mq, offset);
                    log.info("resetOffsetByTimestamp updateConsumeOffset success, {} {} {}",
                        consumerGroup, offset, mq);
                }
            }
        }
    } catch (Exception e) {
        log.warn("resetOffsetByTimestamp Exception", e);
        throw e;
    } finally {
        if (mqs != null) {
            consumer.getDefaultMQPullConsumerImpl().getOffsetStore().persistAll(mqs);
        }
        consumer.shutdown();
    }
}
 
Example #8
Source File: FilterServerUtil.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static void callShell(final String shellString, final InternalLogger log) {
    Process process = null;
    try {
        String[] cmdArray = splitShellString(shellString);
        process = Runtime.getRuntime().exec(cmdArray);
        process.waitFor();
        log.info("CallShell: <{}> OK", shellString);
    } catch (Throwable e) {
        log.error("CallShell: readLine IOException, {}", shellString, e);
    } finally {
        if (null != process) {
            process.destroy();
        }
    }
}
 
Example #9
Source File: Configuration.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public Configuration(InternalLogger log, Object... configObjects) {
    this.log = log;
    if (configObjects == null || configObjects.length == 0) {
        return;
    }
    for (Object configObject : configObjects) {
        registerConfig(configObject);
    }
}
 
Example #10
Source File: MixAll.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * 打印对象的属性
 * @param logger logger
 * @param object object
 * @param onlyImportantField 是否只打印onlyImportantField的文件
 */
public static void printObjectProperties(final InternalLogger logger, final Object object,
    final boolean onlyImportantField) {

    Field[] fields = object.getClass().getDeclaredFields();
    for (Field field : fields) {
        if (!Modifier.isStatic(field.getModifiers())) {
            String name = field.getName();
            if (!name.startsWith("this")) {
                Object value = null;
                try {
                    field.setAccessible(true);
                    value = field.get(object);
                    if (null == value) {
                        value = "";
                    }
                } catch (IllegalAccessException e) {
                    log.error("Failed to obtain object properties", e);
                }

                if (onlyImportantField) {
                    Annotation annotation = field.getAnnotation(ImportantField.class);
                    if (null == annotation) {
                        continue;
                    }
                }

                if (logger != null) {
                    logger.info(name + "=" + value);
                }
            }
        }
    }
}
 
Example #11
Source File: StatsItemSet.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * 实例化
 * @param statsName ;
 * @param scheduledExecutorService ;
 * @param log ;
 */
public StatsItemSet(String statsName, ScheduledExecutorService scheduledExecutorService, InternalLogger log) {
    this.statsName = statsName;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
    this.init();
}
 
Example #12
Source File: StatsItem.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public StatsItem(String statsName, String statsKey, ScheduledExecutorService scheduledExecutorService,
    InternalLogger log) {
    this.statsName = statsName;
    this.statsKey = statsKey;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
}
 
Example #13
Source File: MomentStatsItem.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public MomentStatsItem(String statsName, String statsKey,
    ScheduledExecutorService scheduledExecutorService, InternalLogger log) {
    this.statsName = statsName;
    this.statsKey = statsKey;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
}
 
Example #14
Source File: LoggerTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerConsoleLogger() throws IOException {
    PrintStream out = System.out;
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    System.setOut(new PrintStream(byteArrayOutputStream));

    Appender consoleAppender = LoggingBuilder.newAppenderBuilder()
        .withConsoleAppender(LoggingBuilder.SYSTEM_OUT)
        .withLayout(LoggingBuilder.newLayoutBuilder().withDefaultLayout().build()).build();

    Logger.getLogger("ConsoleLogger").addAppender(consoleAppender);
    Logger.getLogger("ConsoleLogger").setLevel(Level.INFO);

    InternalLogger consoleLogger1 = InternalLoggerFactory.getLogger("ConsoleLogger");
    consoleLogger1.info("console info Message");
    consoleLogger1.error("console error Message", new RuntimeException());
    consoleLogger1.debug("console debug message");

    consoleLogger1.info("console {} test", "simple");
    consoleLogger1.info("[WATERMARK] Send Queue Size: {} SlowTimeMills: {}", 1, 300);
    consoleLogger1.info("new consumer connected, group: {} {} {} channel: {}", "mygroup", "orderly",
        "broudcast", new RuntimeException("simple object"));

    System.setOut(out);
    consoleAppender.close();

    String result = new String(byteArrayOutputStream.toByteArray());

    System.out.println(result);

    Assert.assertTrue(result.contains("info"));
    Assert.assertTrue(result.contains("RuntimeException"));
    Assert.assertTrue(result.contains("WATERMARK"));
    Assert.assertTrue(result.contains("consumer"));
    Assert.assertTrue(result.contains("broudcast"));
    Assert.assertTrue(result.contains("simple test"));
    Assert.assertTrue(!result.contains("debug"));
}
 
Example #15
Source File: LoggerTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerFileLogger() throws IOException {
    String file = loggingDir + "/inner.log";

    Logger fileLogger = Logger.getLogger("innerLogger");

    Appender myappender = LoggingBuilder.newAppenderBuilder()
        .withDailyFileRollingAppender(file, "'.'yyyy-MM-dd")
        .withName("innerAppender")
        .withLayout(LoggingBuilder.newLayoutBuilder().withDefaultLayout().build()).build();

    fileLogger.addAppender(myappender);
    fileLogger.setLevel(Level.INFO);

    InternalLogger innerLogger = InternalLoggerFactory.getLogger("innerLogger");

    innerLogger.info("fileLogger info Message");
    innerLogger.error("fileLogger error Message", new RuntimeException());
    innerLogger.debug("fileLogger debug message");

    myappender.close();

    String content = readFile(file);

    System.out.println(content);

    Assert.assertTrue(content.contains("info"));
    Assert.assertTrue(content.contains("RuntimeException"));
    Assert.assertTrue(!content.contains("debug"));
}
 
Example #16
Source File: LoggerTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerFileLogger() throws IOException {
    String file = loggingDir + "/inner.log";

    Logger fileLogger = Logger.getLogger("innerLogger");

    Appender myappender = LoggingBuilder.newAppenderBuilder()
        .withDailyFileRollingAppender(file, "'.'yyyy-MM-dd")
        .withName("innerAppender")
        .withLayout(LoggingBuilder.newLayoutBuilder().withDefaultLayout().build()).build();

    fileLogger.addAppender(myappender);
    fileLogger.setLevel(Level.INFO);

    InternalLogger innerLogger = InternalLoggerFactory.getLogger("innerLogger");

    innerLogger.info("fileLogger info Message");
    innerLogger.error("fileLogger error Message", new RuntimeException());
    innerLogger.debug("fileLogger debug message");

    myappender.close();

    String content = readFile(file);

    System.out.println(content);

    Assert.assertTrue(content.contains("info"));
    Assert.assertTrue(content.contains("RuntimeException"));
    Assert.assertTrue(!content.contains("debug"));
}
 
Example #17
Source File: FilterServerUtil.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static void callShell(final String shellString, final InternalLogger log) {
    Process process = null;
    try {
        String[] cmdArray = splitShellString(shellString);
        process = Runtime.getRuntime().exec(cmdArray);
        process.waitFor();
        log.info("CallShell: <{}> OK", shellString);
    } catch (Throwable e) {
        log.error("CallShell: readLine IOException, {}", shellString, e);
    } finally {
        if (null != process)
            process.destroy();
    }
}
 
Example #18
Source File: Configuration.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public Configuration(InternalLogger log, Object... configObjects) {
    this.log = log;
    if (configObjects == null || configObjects.length == 0) {
        return;
    }
    for (Object configObject : configObjects) {
        registerConfig(configObject);
    }
}
 
Example #19
Source File: MixAll.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static void printObjectProperties(final InternalLogger logger, final Object object,
    final boolean onlyImportantField) {
    Field[] fields = object.getClass().getDeclaredFields();
    for (Field field : fields) {
        if (!Modifier.isStatic(field.getModifiers())) {
            String name = field.getName();
            if (!name.startsWith("this")) {
                Object value = null;
                try {
                    field.setAccessible(true);
                    value = field.get(object);
                    if (null == value) {
                        value = "";
                    }
                } catch (IllegalAccessException e) {
                    log.error("Failed to obtain object properties", e);
                }

                if (onlyImportantField) {
                    Annotation annotation = field.getAnnotation(ImportantField.class);
                    if (null == annotation) {
                        continue;
                    }
                }

                if (logger != null) {
                    logger.info(name + "=" + value);
                } else {
                }
            }
        }
    }
}
 
Example #20
Source File: StatsItem.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public StatsItem(String statsName, String statsKey, ScheduledExecutorService scheduledExecutorService,
    InternalLogger log) {
    this.statsName = statsName;
    this.statsKey = statsKey;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
}
 
Example #21
Source File: MomentStatsItem.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public MomentStatsItem(String statsName, String statsKey,
    ScheduledExecutorService scheduledExecutorService, InternalLogger log) {
    this.statsName = statsName;
    this.statsKey = statsKey;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
}
 
Example #22
Source File: MomentStatsItem.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public MomentStatsItem(String statsName, String statsKey,
    ScheduledExecutorService scheduledExecutorService, InternalLogger log) {
    this.statsName = statsName;
    this.statsKey = statsKey;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
}
 
Example #23
Source File: ShutdownHookThread.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
/**
     * Create the standard hook thread, with a call back, by using {@link Callable} interface.使用Callable接口创建标准的钩子线程,并返回一个调用。
     *
     * @param log The log instance is used in hook thread.
     * @param callback The call back function.
     */
//
    public ShutdownHookThread(InternalLogger log, Callable callback) {
        super("ShutdownHook");
        this.log = log;
        this.callback = callback;
    }
 
Example #24
Source File: Configuration.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public Configuration(InternalLogger log, Object... configObjects) {
        this.log = log;
        if (configObjects == null || configObjects.length == 0) {
            return;
        }
        for (Object configObject : configObjects) {
//            =》
            registerConfig(configObject);
        }
    }
 
Example #25
Source File: FilterServerUtil.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static void callShell(final String shellString, final InternalLogger log) {
    Process process = null;
    try {
        String[] cmdArray = splitShellString(shellString);
        process = Runtime.getRuntime().exec(cmdArray);
        process.waitFor();
        log.info("CallShell: <{}> OK", shellString);
    } catch (Throwable e) {
        log.error("CallShell: readLine IOException, {}", shellString, e);
    } finally {
        if (null != process)
            process.destroy();
    }
}
 
Example #26
Source File: MixAll.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static void printObjectProperties(final InternalLogger logger, final Object object,
    final boolean onlyImportantField) {
    Field[] fields = object.getClass().getDeclaredFields();
    for (Field field : fields) {
        if (!Modifier.isStatic(field.getModifiers())) {
            String name = field.getName();
            if (!name.startsWith("this")) {
                Object value = null;
                try {
                    field.setAccessible(true);
                    value = field.get(object);
                    if (null == value) {
                        value = "";
                    }
                } catch (IllegalAccessException e) {
                    log.error("Failed to obtain object properties", e);
                }

                if (onlyImportantField) {
                    Annotation annotation = field.getAnnotation(ImportantField.class);
                    if (null == annotation) {
                        continue;
                    }
                }

                if (logger != null) {
                    logger.info(name + "=" + value);
                } else {
                }
            }
        }
    }
}
 
Example #27
Source File: StatsItem.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public StatsItem(String statsName, String statsKey, ScheduledExecutorService scheduledExecutorService,
    InternalLogger log) {
    this.statsName = statsName;
    this.statsKey = statsKey;
    this.scheduledExecutorService = scheduledExecutorService;
    this.log = log;
}
 
Example #28
Source File: MQHelper.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
/**
 * Reset consumer topic offset according to time 根据时间重置消费者主题偏移量
 *
 * @param messageModel which model
 * @param instanceName which instance
 * @param consumerGroup consumer group
 * @param topic topic
 * @param timestamp time
 */
public static void resetOffsetByTimestamp(
    final MessageModel messageModel,
    final String instanceName,
    final String consumerGroup,
    final String topic,
    final long timestamp) throws Exception {
    final InternalLogger log = ClientLogger.getLog();

    DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(consumerGroup);
    consumer.setInstanceName(instanceName);
    consumer.setMessageModel(messageModel);
    consumer.start();

    Set<MessageQueue> mqs = null;
    try {
        mqs = consumer.fetchSubscribeMessageQueues(topic);
        if (mqs != null && !mqs.isEmpty()) {
            TreeSet<MessageQueue> mqsNew = new TreeSet<MessageQueue>(mqs);
            for (MessageQueue mq : mqsNew) {
                long offset = consumer.searchOffset(mq, timestamp);
                if (offset >= 0) {
                    consumer.updateConsumeOffset(mq, offset);
                    log.info("resetOffsetByTimestamp updateConsumeOffset success, {} {} {}",
                        consumerGroup, offset, mq);
                }
            }
        }
    } catch (Exception e) {
        log.warn("resetOffsetByTimestamp Exception", e);
        throw e;
    } finally {
        if (mqs != null) {
            consumer.getDefaultMQPullConsumerImpl().getOffsetStore().persistAll(mqs);
        }
        consumer.shutdown();
    }
}
 
Example #29
Source File: LoggerTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerConsoleLogger() throws IOException {
    PrintStream out = System.out;
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    System.setOut(new PrintStream(byteArrayOutputStream));

    Appender consoleAppender = LoggingBuilder.newAppenderBuilder()
        .withConsoleAppender(LoggingBuilder.SYSTEM_OUT)
        .withLayout(LoggingBuilder.newLayoutBuilder().withDefaultLayout().build()).build();

    Logger.getLogger("ConsoleLogger").addAppender(consoleAppender);
    Logger.getLogger("ConsoleLogger").setLevel(Level.INFO);

    InternalLogger consoleLogger1 = InternalLoggerFactory.getLogger("ConsoleLogger");
    consoleLogger1.info("console info Message");
    consoleLogger1.error("console error Message", new RuntimeException());
    consoleLogger1.debug("console debug message");

    consoleLogger1.info("console {} test", "simple");
    consoleLogger1.info("[WATERMARK] Send Queue Size: {} SlowTimeMills: {}", 1, 300);
    consoleLogger1.info("new consumer connected, group: {} {} {} channel: {}", "mygroup", "orderly",
        "broudcast", new RuntimeException("simple object"));

    System.setOut(out);
    consoleAppender.close();

    String result = new String(byteArrayOutputStream.toByteArray());

    System.out.println(result);

    Assert.assertTrue(result.contains("info"));
    Assert.assertTrue(result.contains("RuntimeException"));
    Assert.assertTrue(result.contains("WATERMARK"));
    Assert.assertTrue(result.contains("consumer"));
    Assert.assertTrue(result.contains("broudcast"));
    Assert.assertTrue(result.contains("simple test"));
    Assert.assertTrue(!result.contains("debug"));
}
 
Example #30
Source File: LoggerTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testInnerConsoleLogger() throws IOException {
    PrintStream out = System.out;
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    System.setOut(new PrintStream(byteArrayOutputStream));

    Appender consoleAppender = LoggingBuilder.newAppenderBuilder()
        .withConsoleAppender(LoggingBuilder.SYSTEM_OUT)
        .withLayout(LoggingBuilder.newLayoutBuilder().withDefaultLayout().build()).build();

    Logger.getLogger("ConsoleLogger").addAppender(consoleAppender);
    Logger.getLogger("ConsoleLogger").setLevel(Level.INFO);

    InternalLogger consoleLogger1 = InternalLoggerFactory.getLogger("ConsoleLogger");
    consoleLogger1.info("console info Message");
    consoleLogger1.error("console error Message", new RuntimeException());
    consoleLogger1.debug("console debug message");

    consoleLogger1.info("console {} test", "simple");
    consoleLogger1.info("[WATERMARK] Send Queue Size: {} SlowTimeMills: {}", 1, 300);
    consoleLogger1.info("new consumer connected, group: {} {} {} channel: {}", "mygroup", "orderly",
        "broudcast", new RuntimeException("simple object"));

    System.setOut(out);
    consoleAppender.close();

    String result = new String(byteArrayOutputStream.toByteArray());

    System.out.println(result);

    Assert.assertTrue(result.contains("info"));
    Assert.assertTrue(result.contains("RuntimeException"));
    Assert.assertTrue(result.contains("WATERMARK"));
    Assert.assertTrue(result.contains("consumer"));
    Assert.assertTrue(result.contains("broudcast"));
    Assert.assertTrue(result.contains("simple test"));
    Assert.assertTrue(!result.contains("debug"));
}