@Override
      public void run() {
        while (statement.hasMoreLogs()) {
          try {
            incrementalLogs.addAll(statement.getQueryLog());
            Thread.sleep(500);
          } catch (SQLException e) {
            LOG.error("Failed getQueryLog. Error message: " + e.getMessage());
            fail("error in getting log thread");
          } catch (InterruptedException e) {
            LOG.error("Getting log thread is interrupted. Error message: " + e.getMessage());
            fail("error in getting log thread");
          }
        }
      }
Test getting query log method in Jdbc
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/cbo_rp_TestJdbcDriver2.java