private Appender getAppender(String routingAppenderName, String queryId)
          throws NoSuchFieldException, IllegalAccessException {
    LoggerContext context = (LoggerContext) LogManager.getContext(false);
    Configuration configuration = context.getConfiguration();
    LoggerConfig loggerConfig = configuration.getRootLogger();
    Map<String, Appender> appendersMap = loggerConfig.getAppenders();
    RoutingAppender routingAppender = (RoutingAppender) appendersMap.get(routingAppenderName);
    Assert.assertNotNull("could not find routingAppender " + routingAppenderName, routingAppender);
    Field defaultsField = RoutingAppender.class.getDeclaredField("createdAppenders");
    defaultsField.setAccessible(true);
    ConcurrentHashMap appenders = (ConcurrentHashMap) defaultsField.get(routingAppender);
    AppenderControl appenderControl = (AppenderControl) appenders.get(queryId);
    if(appenderControl != null) {
      return appenderControl.getAppender();
    } else {
      return null;
    }
  }
Get the appender associated with a query.
@param routingAppenderName Routing appender name
@param queryId Query Id for the operation
@return Appender if found, else null
@throws NoSuchFieldException
@throws IllegalAccessException
itests/hive-unit/src/test/java/org/apache/hive/service/cli/operation/TestOperationLoggingLayout.java