use of org.apache.logging.log4j.core.selector.ClassLoaderContextSelector 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);
}
Aggregations