public void error(Object message) { if (message instanceof String || this.logger.isErrorEnabled()) { this.logger.error(String.valueOf(message)); } }
@Override public boolean isEnabled(int level) { switch (level) { case TraceSystem.DEBUG: return logger.isDebugEnabled(); case TraceSystem.INFO: return logger.isInfoEnabled(); case TraceSystem.ERROR: return logger.isErrorEnabled(); default: return false; } }
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(); } }
private void logException(Throwable cause) { //handling connection reset by peer exceptions if (cause instanceof IOException && IGNORABLE_ERROR_MESSAGE.matcher(cause.getMessage()).matches()) { if (LOG.isDebugEnabled()) { LOG.debug("Swallowed an IOException caused by client connectivity: " + cause.getMessage(), cause); } } else { if (LOG.isErrorEnabled()) { LOG.error("Unexpected error occurred: " + cause.getMessage(), cause); } } }
@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; }
logger.error("Retry #{} for: {}", retry, e.getMessage()); if (++logCounter == 1 && logger.isInfoEnabled()) logger.info("Exception --> " + ExceptionUtils.getStackTrace(e)); sleeper.sleep(delay); } else if (delay >= max && retry <= maxRetries) { if (logger.isErrorEnabled()) { logger.error( String.format( "Retry #%d for: %s",
@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; } }
public AbstractTableWriterModelCell(AbstractTableWriterModel table, int row, int col, Tc tc, Node content) { super(table, row, col, tc); this.content = content; if (content==null) { if(logger.isErrorEnabled()) { logger.error("No content for row " + row + ", col " + col + "\n" + XmlUtils.marshaltoString(tc, true, true)); } } else { if(logger.isDebugEnabled()) { logger.debug("Cell content for row " + row + ", col " + col + "\n" + XmlUtils.w3CDomNodeToString(content)); } } /* xhtmlTc.appendChild( document.importNode(tcDoc, true) ); com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.importNode org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation */ }
public void error(Object message, Throwable exception) { if (message instanceof String || this.logger.isErrorEnabled()) { this.logger.error(String.valueOf(message), exception); } }
@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; }
if (LOG.isInfoEnabled()) { LOG.info("De-registered service [{}] with {}", applicationName, discoveryService); if (LOG.isErrorEnabled()) { LOG.error("Error occurred de-registering service [" + applicationName + "] with " + discoveryService + ": " + t.getMessage(), t);
@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; } }
@Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { Channel channel = ctx.channel(); channel.attr(NettyRxWebSocketSession.WEB_SOCKET_SESSION_KEY).set(null); if (LOG.isDebugEnabled()) { LOG.debug("Removing WebSocket Server session: " + session); } webSocketSessionRepository.removeChannel(channel); try { eventPublisher.publishEvent(new WebSocketSessionClosedEvent(session)); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error("Error publishing WebSocket closed event: " + e.getMessage(), e); } } super.handlerRemoved(ctx); }
@Override public void onError(Throwable t) { String errorMessage = getErrorMessage(t, "Error reporting state to Eureka: "); if (LOG.isErrorEnabled()) { LOG.error(errorMessage, t); } }
/** * 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; }
GetOperationRequest operationRequest = new GetOperationRequest().withOperationId(operationId); GetOperationResult result = discoveryClient.getOperation(operationRequest); if (LOG.isInfoEnabled()) { LOG.info("Service registration for operation " + operationId + " resulted in " + result.getOperation().getStatus()); if (result.getOperation().getStatus().equalsIgnoreCase("failure")) { if (route53AutoRegistrationConfiguration.isFailFast() && embeddedServerInstance instanceof EmbeddedServerInstance) { if (LOG.isErrorEnabled()) { LOG.error("Error registering instance shutting down instance because failfast is set."); Thread.currentThread().sleep(5000); } catch (InterruptedException e) { if (LOG.isErrorEnabled()) { LOG.error("Registration monitor service has been aborted, unable to verify proper service registration on Route 53.", e);
/** * Determines whether the priority passed as parameter is enabled in the * underlying SLF4J logger. Each log4j priority is mapped directly to its * SLF4J equivalent, except for FATAL which is mapped as ERROR. * * @param p * the priority to check against * @return true if this logger is enabled for the given level, false * otherwise. */ public boolean isEnabledFor(Priority p) { switch (p.level) { case Level.TRACE_INT: return slf4jLogger.isTraceEnabled(); case Level.DEBUG_INT: return slf4jLogger.isDebugEnabled(); case Level.INFO_INT: return slf4jLogger.isInfoEnabled(); case Level.WARN_INT: return slf4jLogger.isWarnEnabled(); case Level.ERROR_INT: return slf4jLogger.isErrorEnabled(); case Priority.FATAL_INT: return slf4jLogger.isErrorEnabled(); } return false; }
if (log.isDebugEnabled()) { log.debug("Scheduling session validation job using Quartz with " + "session validation interval of [" + sessionValidationInterval + "]ms..."); if (schedulerImplicitlyCreated) { scheduler.start(); if (log.isDebugEnabled()) { log.debug("Successfully started implicitly created Quartz Scheduler instance."); if (log.isDebugEnabled()) { log.debug("Session validation job successfully scheduled with Quartz."); if (log.isErrorEnabled()) { log.error("Error starting the Quartz session validation job. Session validation may not occur.", e);
/** * Error. * * @param logger the logger * @param format the format * @param supplier the supplier */ public static void error(Logger logger, String format, Supplier<Object> supplier) { if (logger.isErrorEnabled()) { logger.error(format, supplier.get()); } }