Search in sources :

Example 1 with AsyncLoggerContextSelector

use of org.apache.logging.log4j.core.async.AsyncLoggerContextSelector in project hive by apache.

the class TestHiveAsyncLogging method testAsyncLoggingInitialization.

// this test requires disruptor jar in classpath
@Test
public void testAsyncLoggingInitialization() throws Exception {
    HiveConf conf = new HiveConf();
    conf.setBoolVar(ConfVars.HIVE_ASYNC_LOG_ENABLED, false);
    LogUtils.initHiveLog4jCommon(conf, ConfVars.HIVE_LOG4J_FILE);
    Log4jContextFactory log4jContextFactory = (Log4jContextFactory) LogManager.getFactory();
    ContextSelector contextSelector = log4jContextFactory.getSelector();
    assertTrue(contextSelector instanceof ClassLoaderContextSelector);
    conf.setBoolVar(ConfVars.HIVE_ASYNC_LOG_ENABLED, true);
    LogUtils.initHiveLog4jCommon(conf, ConfVars.HIVE_LOG4J_FILE);
    log4jContextFactory = (Log4jContextFactory) LogManager.getFactory();
    contextSelector = log4jContextFactory.getSelector();
    assertTrue(contextSelector instanceof AsyncLoggerContextSelector);
}
Also used : Log4jContextFactory(org.apache.logging.log4j.core.impl.Log4jContextFactory) AsyncLoggerContextSelector(org.apache.logging.log4j.core.async.AsyncLoggerContextSelector) ContextSelector(org.apache.logging.log4j.core.selector.ContextSelector) ClassLoaderContextSelector(org.apache.logging.log4j.core.selector.ClassLoaderContextSelector) ClassLoaderContextSelector(org.apache.logging.log4j.core.selector.ClassLoaderContextSelector) AsyncLoggerContextSelector(org.apache.logging.log4j.core.async.AsyncLoggerContextSelector) Test(org.junit.Test)

Aggregations

AsyncLoggerContextSelector (org.apache.logging.log4j.core.async.AsyncLoggerContextSelector)1 Log4jContextFactory (org.apache.logging.log4j.core.impl.Log4jContextFactory)1 ClassLoaderContextSelector (org.apache.logging.log4j.core.selector.ClassLoaderContextSelector)1 ContextSelector (org.apache.logging.log4j.core.selector.ContextSelector)1 Test (org.junit.Test)1