/** * Log a task that has been rejected by {@link #doRescheduleTask}. * <p>The default implementation simply logs a corresponding message * at debug level. * @param task the rejected task object * @param ex the exception thrown from {@link #doRescheduleTask} */ protected void logRejectedTask(Object task, RuntimeException ex) { if (logger.isDebugEnabled()) { logger.debug("Listener container task [" + task + "] has been rejected and paused: " + ex); } }
/** * Convenience method to return a named logger. * @param name logical name of the <code>Log</code> instance to be returned */ public static Log getLog(String name) { return LogAdapter.createLog(name); }
@Override protected Object readResolve() { return Slf4jAdapter.createLocationAwareLog(this.name); } }
@Override public void onFailure(Throwable ex) { logger.error("Failed to connect", ex); } });
@Override public void handleError(Throwable t) { if (logger.isErrorEnabled()) { logger.error("Unexpected error occurred in scheduled task.", t); } } }
/** * Writes a log message after the request is processed. */ @Override protected void afterRequest(HttpServletRequest request, String message) { logger.debug(message); }
@Override public void registerDestructionCallback(String name, Runnable callback, int scope) { if (logger.isWarnEnabled()) { logger.warn("Could not register destruction callback [" + callback + "] for attribute '" + name + "' because FacesRequestAttributes does not support such callbacks"); } }
@Override public void registerDestructionCallback(String name, Runnable callback) { logger.warn("SimpleThreadScope does not support destruction callbacks. " + "Consider using RequestScope in a web environment."); }
/** * Creates a new instance of the {@code HttpMessageConverterExtractor} with the given response * type and message converters. The given converters must support the response type. */ public HttpMessageConverterExtractor(Type responseType, List<HttpMessageConverter<?>> messageConverters) { this(responseType, messageConverters, LogFactory.getLog(HttpMessageConverterExtractor.class)); }
/** * Determine whether the given {@link Log} instance is enabled. * <p>Default is {@code true} when the "trace" level is enabled. * Subclasses can override this to change the level under which 'tracing' occurs. * @param logger the {@code Log} instance to check */ protected boolean isLogEnabled(Log logger) { return logger.isTraceEnabled(); }
public static Log createLocationAwareLog(String name) { Logger logger = LoggerFactory.getLogger(name); return (logger instanceof LocationAwareLogger ? new Slf4jLocationAwareLog((LocationAwareLogger) logger) : new Slf4jLog<>(logger)); }
/** * {@inheritDoc} */ @Override public void logStatistics() { if (statsLogger.isDebugEnabled()) { statsLogger.debug("Spring test ApplicationContext cache statistics: " + this); } }
/** * Handle the given exception that arose during listener execution. * The default implementation logs the exception at error level. * <p>This method only applies when used as standard JMS {@link MessageListener}. * In case of the Spring {@link SessionAwareMessageListener} mechanism, * exceptions get handled by the caller instead. * @param ex the exception to handle * @see #onMessage(javax.jms.Message) */ protected void handleListenerException(Throwable ex) { logger.error("Listener execution failed", ex); }
@Override public void handleUncaughtException(Throwable ex, Method method, Object... params) { if (logger.isErrorEnabled()) { logger.error("Unexpected exception occurred invoking async method: " + method, ex); } }
/** * Writes a log message before the request is processed. */ @Override protected void beforeRequest(HttpServletRequest request, String message) { logger.debug(message); }
/** * Actually write to the underlying log. * <p>The default implementations logs the message at "warn" level. * @param message the message to write */ protected void writeToLog(String message) { logger.warn(message); }
/** * Set the log category for warn logging. * <p>Default is no warn logging. Specify this setting to activate warn * logging into a specific category. * @since 5.1 * @see org.apache.commons.logging.LogFactory#getLog(String) * @see java.util.logging.Logger#getLogger(String) */ public void setWarnLogCategory(String loggerName) { this.warnLogger = LogFactory.getLog(loggerName); }
@Override public void handleException(StompSession session, StompCommand command, StompHeaders headers, byte[] payload, Throwable ex) { logger.error(command + " " + headers, ex); }
@Override public void handleTransportError(StompSession session, Throwable exception) { logger.error(exception); } }
@Override public void handleTransportError(StompSession session, Throwable exception) { logger.error(exception); } }