@PluginFactory public static NameFilter createFilter( @PluginAttribute("loggingLevel") final String loggingLevel) { // Name required for routing. Error out if it is not set. Preconditions.checkNotNull(loggingLevel, "loggingLevel must be specified for " + NameFilter.class.getName()); return new NameFilter(OperationLog.getLoggingLevel(loggingLevel)); } }
@Override public Result filter(LogEvent event) { boolean excludeMatches = (loggingMode == OperationLog.LoggingLevel.VERBOSE); String logLevel = event.getContextMap().get(LogUtils.OPERATIONLOG_LEVEL_KEY); logLevel = logLevel == null ? "" : logLevel; OperationLog.LoggingLevel currentLoggingMode = OperationLog.getLoggingLevel(logLevel); // If logging is disabled, deny everything. if (currentLoggingMode == OperationLog.LoggingLevel.NONE) { return Result.DENY; } // Look at the current session's setting // and set the pattern and excludeMatches accordingly. if (currentLoggingMode != loggingMode) { loggingMode = currentLoggingMode; excludeMatches = (loggingMode == OperationLog.LoggingLevel.VERBOSE); setCurrentNamePattern(loggingMode); } boolean isMatch = namePattern.matcher(event.getLoggerName()).matches(); if (excludeMatches == isMatch) { // Deny if this is black-list filter (excludeMatches = true) and it // matched or if this is whitelist filter and it didn't match return Result.DENY; } return Result.NEUTRAL; }
public OperationLog(String name, File file, HiveConf hiveConf) throws FileNotFoundException { operationName = name; logFile = new LogFile(file); if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_ENABLED)) { String logLevel = hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL); opLoggingLevel = getLoggingLevel(logLevel); } }
public OperationLog(String name, File file, HiveConf hiveConf) { operationName = name; logFile = new LogFile(file); if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_ENABLED)) { String logLevel = hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL); opLoggingLevel = getLoggingLevel(logLevel); } else { opLoggingLevel = LoggingLevel.UNKNOWN; } // If in test mod create a test log file which will contain only logs which are supposed to // be written to the qtest output if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST)) { isRemoveLogs = hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_TESTING_REMOVE_LOGS); if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_TESTING_SHORT_LOGS)) { testLogFile = new LogFile(new File(file.getAbsolutePath() + ".test")); isShortLogs = true; } else { testLogFile = null; isShortLogs = false; } } else { testLogFile = null; isShortLogs = false; isRemoveLogs = true; } }
OperationLog.LoggingLevel loggingMode = OperationLog.getLoggingLevel(loggingLevel); String layout = loggingMode == OperationLog.LoggingLevel.VERBOSE ? verboseLayout : nonVerboseLayout; String logLocation = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LOG_LOCATION);
private void initOperationLogCapture(String loggingMode) { // Register another Appender (with the same layout) that talks to us. Appender ap = new LogDivertAppender(this, OperationLog.getLoggingLevel(loggingMode)); Logger.getRootLogger().addAppender(ap); }
private void initOperationLogCapture(String loggingMode) { // Register another Appender (with the same layout) that talks to us. Appender ap = new LogDivertAppender(this, OperationLog.getLoggingLevel(loggingMode)); Logger.getRootLogger().addAppender(ap); }
private void initOperationLogCapture(String loggingMode) { // Register another Appender (with the same layout) that talks to us. Appender ap = new LogDivertAppender(this, OperationLog.getLoggingLevel(loggingMode)); Logger.getRootLogger().addAppender(ap); }
private void initOperationLogCapture(String loggingMode) { // Register another Appender (with the same layout) that talks to us. Appender ap = new LogDivertAppender(this, OperationLog.getLoggingLevel(loggingMode)); Logger.getRootLogger().addAppender(ap); }
public OperationLog(String name, File file, HiveConf hiveConf) throws FileNotFoundException { operationName = name; logFile = new LogFile(file); if (hiveConf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_ENABLED)) { String logLevel = hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL); opLoggingLevel = getLoggingLevel(logLevel); } }