private static boolean checkAndSetAsyncLogging(final Configuration conf) {
    final boolean asyncLogging = MetastoreConf.getBoolVar(conf, ConfVars.ASYNC_LOG_ENABLED);
    if (asyncLogging) {
      System.setProperty("Log4jContextSelector",
          "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
      // default is ClassLoaderContextSelector which is created during automatic logging
      // initialization in a static initialization block.
      // Changing ContextSelector at runtime requires creating new context factory which will
      // internally create new context selector based on system property.
      LogManager.setFactory(new Log4jContextFactory());
    }
    return asyncLogging;
  }
Initialize log4j.

@return an message suitable for display to the user
@throws LogInitializationException if log4j fails to initialize correctly
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/LogUtils.java