public void warn(Object message) { if (message instanceof String || this.logger.isWarnEnabled()) { this.logger.warn(String.valueOf(message)); } }
private boolean infoOrHigherEnabled(final Level level) { if (level == Level.INFO) { return logger.isInfoEnabled(); } else if (level == Level.WARN) { return logger.isWarnEnabled(); } else if (level == Level.ERROR || level == Level.FATAL) { return logger.isErrorEnabled(); } return true; }
@Override public boolean isEnabled(final Level level) { switch (level) { case TRACE: return logger.isTraceEnabled(); case DEBUG: return logger.isDebugEnabled(); case INFO: return logger.isInfoEnabled(); case WARN: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: throw new IllegalArgumentException(); } }
result = xPath.evaluate(xpathString, doc ); if (result.equals("") && log.isWarnEnabled()) { log.warn("No match for " + xpathString + " so result is empty string"); } else { log.debug(xpathString + " ---> '" + result + "'"); log.debug(xpathString + " ---> '" + result + "'");
@Override public void close() throws IOException { if (this.invalidLineCount > 0) { if (LOG.isWarnEnabled()) { LOG.warn("In file \"" + currentSplit.getPath() + "\" (split start: " + this.splitStart + ") " + this.invalidLineCount +" invalid line(s) were skipped."); } } if (this.commentCount > 0) { if (LOG.isInfoEnabled()) { LOG.info("In file \"" + currentSplit.getPath() + "\" (split start: " + this.splitStart + ") " + this.commentCount +" comment line(s) were skipped."); } } super.close(); }
@Override public BaseStatistics getStatistics(BaseStatistics cachedStats) throws IOException { // only gather base statistics for FileInputFormats if (!(mapredInputFormat instanceof FileInputFormat)) { return null; } final FileBaseStatistics cachedFileStats = (cachedStats instanceof FileBaseStatistics) ? (FileBaseStatistics) cachedStats : null; try { final org.apache.hadoop.fs.Path[] paths = FileInputFormat.getInputPaths(this.jobConf); return getFileStats(cachedFileStats, paths, new ArrayList<FileStatus>(1)); } catch (IOException ioex) { if (LOG.isWarnEnabled()) { LOG.warn("Could not determine statistics due to an io error: " + ioex.getMessage()); } } catch (Throwable t) { if (LOG.isErrorEnabled()) { LOG.error("Unexpected problem while getting the file statistics: " + t.getMessage(), t); } } // no statistics available return null; }
LOG.debug("Materialized view " + materializedViewTable.getFullyQualifiedName() + " ignored for rewriting as its contents are outdated"); continue; if (LOG.isDebugEnabled()) { LOG.debug("Materialized view " + materializedViewTable.getFullyQualifiedName() + " was not in the cache"); if (LOG.isWarnEnabled()) { LOG.info("Materialized view " + materializedViewTable.getFullyQualifiedName() + " was skipped " + "because cache has not been loaded yet");
/** * Return the level in effect for this category/logger. * * <p> * The result is computed by simulation. * * @return */ public Level getEffectiveLevel() { if (slf4jLogger.isTraceEnabled()) { return Level.TRACE; } if (slf4jLogger.isDebugEnabled()) { return Level.DEBUG; } if (slf4jLogger.isInfoEnabled()) { return Level.INFO; } if (slf4jLogger.isWarnEnabled()) { return Level.WARN; } return Level.ERROR; }
@Override public boolean isEnabled(int level) { switch (level) { case com.jcraft.jsch.Logger.DEBUG: return LOG.isDebugEnabled(); case com.jcraft.jsch.Logger.INFO: return LOG.isInfoEnabled(); case com.jcraft.jsch.Logger.WARN: return LOG.isWarnEnabled(); case com.jcraft.jsch.Logger.ERROR: case com.jcraft.jsch.Logger.FATAL: return LOG.isErrorEnabled(); default: return false; } }
public void warn(Object message, Throwable exception) { if (message instanceof String || this.logger.isWarnEnabled()) { this.logger.warn(String.valueOf(message), exception); } }
"error? (Typical or expected login exceptions should extend from AuthenticationException)."; ae = new AuthenticationException(msg, t); if (log.isWarnEnabled()) log.warn(msg, t); if (log.isWarnEnabled()) { String msg = "Unable to send notification for failed authentication attempt - listener error?. " + "Please check your AuthenticationListener implementation(s). Logging sending exception " + "and propagating original AuthenticationException instead..."; log.warn(msg, t2); log.debug("Authentication successful for token [{}]. Returned account [{}]", token, info);
private void reconnectService() { Collection<URL> allRegisteredServices = getRegisteredServiceUrls(); if (allRegisteredServices != null && !allRegisteredServices.isEmpty()) { try { serverLock.lock(); for (URL url : getRegisteredServiceUrls()) { doRegister(url); } if(logger.isInfoEnabled()) logger.info("[{}] reconnect: register services {}", registryClassName, allRegisteredServices); for (URL url : availableServices) { if (!getRegisteredServiceUrls().contains(url)) { if(logger.isWarnEnabled()) logger.warn("reconnect url not register. url:{}", url); continue; } doAvailable(url); } if(logger.isInfoEnabled()) logger.info("[{}] reconnect: available services {}", registryClassName, availableServices); } finally { serverLock.unlock(); } } } }
@Override public BaseStatistics getStatistics(BaseStatistics cachedStats) throws IOException { // only gather base statistics for FileInputFormats if (!(mapreduceInputFormat instanceof FileInputFormat)) { return null; } JobContext jobContext = new JobContextImpl(configuration, null); final FileBaseStatistics cachedFileStats = (cachedStats instanceof FileBaseStatistics) ? (FileBaseStatistics) cachedStats : null; try { final org.apache.hadoop.fs.Path[] paths = FileInputFormat.getInputPaths(jobContext); return getFileStats(cachedFileStats, paths, new ArrayList<FileStatus>(1)); } catch (IOException ioex) { if (LOG.isWarnEnabled()) { LOG.warn("Could not determine statistics due to an io error: " + ioex.getMessage()); } } catch (Throwable t) { if (LOG.isErrorEnabled()) { LOG.error("Unexpected problem while getting the file statistics: " + t.getMessage(), t); } } // no statistics available return null; }
@Override public boolean isEnabled(int level) { switch (level) { case DEBUG: return log.isDebugEnabled(); case INFO: return log.isInfoEnabled(); case WARN: return log.isWarnEnabled(); case ERROR: return log.isErrorEnabled(); case FATAL: return log.isErrorEnabled(); default: return false; } }
private static void joinThread(Thread t) { while (t.isAlive()) { try { t.join(); } catch (InterruptedException ie) { if (LOG.isWarnEnabled()) { LOG.warn("Interrupted while joining on: " + t, ie); } t.interrupt(); // propagate interrupt } } }
= (CustomXmlDataStoragePart)customXmlParts.get(itemId); if (customXmlDataStoragePart==null) { log.warn("Couldn't find CustomXmlDataStoragePart referenced from sdt bound with " + itemId); } else { log.debug("Using " + itemId); if(log.isWarnEnabled()) { log.warn("Couldn't find CustomXmlDataStoragePart referenced from " + XmlUtils.marshaltoString(element)); log.debug("Using " + element.getSdtPr().getDataBinding().getStoreItemID()); customXmlDataStoragePart = (CustomXmlDataStoragePart)customXmlParts.get(itemId); log.warn("TODO: support StandardisedAnswersPart"); return;
if (Optimizer.LOG.isWarnEnabled()) { Optimizer.LOG.warn("Could not instantiate InputFormat to obtain statistics." + " Limited statistics will be available.", t); if (Optimizer.LOG.isWarnEnabled()) { Optimizer.LOG.warn("Error obtaining statistics from input format: " + t.getMessage(), t); final long len = bs.getTotalInputSize(); if (len == BaseStatistics.SIZE_UNKNOWN) { if (Optimizer.LOG.isInfoEnabled()) { Optimizer.LOG.info("Compiler could not determine the size of input '" + inFormatDescription + "'. Using default estimates.");
/** * Obtains basic file statistics containing only file size. If the input is a directory, then the size is the sum of all contained files. * * @see org.apache.flink.api.common.io.InputFormat#getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics) */ @Override public FileBaseStatistics getStatistics(BaseStatistics cachedStats) throws IOException { final FileBaseStatistics cachedFileStats = cachedStats instanceof FileBaseStatistics ? (FileBaseStatistics) cachedStats : null; try { return getFileStats(cachedFileStats, getFilePaths(), new ArrayList<>(getFilePaths().length)); } catch (IOException ioex) { if (LOG.isWarnEnabled()) { LOG.warn("Could not determine statistics for paths '" + Arrays.toString(getFilePaths()) + "' due to an io error: " + ioex.getMessage()); } } catch (Throwable t) { if (LOG.isErrorEnabled()) { LOG.error("Unexpected problem while getting the file statistics for paths '" + Arrays.toString(getFilePaths()) + "': " + t.getMessage(), t); } } // no statistics available return null; }
private String resolveLoggingLevel(String loggerName) { Logger logger = LoggerFactory.getLogger(loggerName); if (logger.isTraceEnabled()) { return "trace"; } else if (logger.isDebugEnabled()) { return "debug"; } else if (logger.isInfoEnabled()) { return "info"; } else if (logger.isWarnEnabled()) { return "warn"; } else if (logger.isErrorEnabled()) { return "error"; } else { throw new IllegalStateException("Logging level for loggerName (" + loggerName + ") cannot be determined."); } }
/** * Warn. * * @param logger the logger * @param format the format * @param supplier the supplier */ public static void warn(Logger logger, String format, Supplier<Object> supplier) { if (logger.isWarnEnabled()) { logger.warn(format, supplier.get()); } }