@Override public void perform(Rewrite event, EvaluationContext context) { String message = messageBuilder.build(event, context); switch (level) { case TRACE: if (log.isTraceEnabled()) log.trace(message); break; case DEBUG: if (log.isDebugEnabled()) log.debug(message); break; case INFO: if (log.isInfoEnabled()) log.info(message); break; case WARN: if (log.isWarnEnabled()) log.warn(message); break; case ERROR: if (log.isErrorEnabled()) log.error(message); break; default: break; } }
/** * Create a {@link Logger} instance for a specific class * * @param clazz The class to create the log for * @return The {@link Logger} instance */ public static Logger getLogger(final Class<?> clazz) { return getLogger(clazz.getName()); }
public void trace(final String msg) { if (isTraceEnabled()) { log(Level.TRACE, msg, null); } }
public void info(final String msg, final Object[] argArray) { if (isInfoEnabled()) { log(Level.INFO, format(msg, argArray), null); } }
public void info(final String msg) { if (isInfoEnabled()) { log(Level.INFO, msg, null); } }
protected void closeQuietly(Closeable closeable) { try { closeable.close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } }
@Override public <T> void enrich(final T service) { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(service); if (log.isDebugEnabled()) log.debug("Enriched instance of service [" + service.getClass().getName() + "]"); }
private void checkConfLocal(final Conf conf) { if (conf.isOk() && conf.isEngineEnabled()) { urlRewriter = new UrlRewriter(conf); log.debug("Tuckey UrlRewriteFilter configuration loaded (Status: OK)"); } else { if (!conf.isOk()) { log.error("Tuckey UrlRewriteFilter configuration failed (Status: ERROR)"); } if (!conf.isEngineEnabled()) { log.warn("Tuckey UrlRewriteFilter engine explicitly disabled in configuration"); } if (urlRewriter != null) { log.debug("Tuckey UrlRewriteFilter configuration unloaded"); urlRewriter = null; } } }
@Override public Object getInstance(Class<?> type) { Object result = null; try { result = type.newInstance(); } catch (Exception e) { log.debug("Could not create instance of type [" + type.getName() + "] through reflection.", e); } return result; }
if (log.isDebugEnabled()) log.debug("Processing JAR file: " + jarUrl.toString()); log.error("Failed to read JAR file: " + jarUrl.toString(), e);
if (log.isTraceEnabled()) { log.trace("Service provider [{}] returned [{}] for class [{}]", new Object[] { resolver.getClass().getSimpleName(), beanName, clazz.getName() }); .toString(); if (log.isTraceEnabled()) { log.debug("Creation of EL expression for component [{}] of class [{}] successful: {}", new Object[] { component, clazz.getName(), el });
/** * Process one {@link AnnotatedElement} of the class. */ private void visit(AnnotatedElement element, ClassContext context) { List<AnnotationHandler<Annotation>> elementHandlers = new ArrayList<AnnotationHandler<Annotation>>(); // check if any of the handlers is responsible for (AnnotationHandler<Annotation> handler : handlerList) { // each annotation on the element may be interesting for us for (Annotation annotation : element.getAnnotations()) { if (handler.handles().equals(annotation.annotationType())) { elementHandlers.add(handler); } } } if (!elementHandlers.isEmpty()) { if (log.isTraceEnabled()) { log.trace("Executing handler chain on " + element + ": " + elementHandlers); } // execute the handler chain new HandlerChainImpl(context, element, elementHandlers).proceed(); } }
public void debug(final String msg, final Object arg) { if (isDebugEnabled()) { log(Level.DEBUG, format(msg, new Object[] { arg }), null); } }
private static List<String> findPaths(Path path, boolean relativeOnly) { List<String> results = new ArrayList<>(); results.add(path.normalize().toAbsolutePath().toString()); if (Files.isDirectory(path)) { try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) { for (Path child : directoryStream) { results.addAll(findPaths(child, relativeOnly)); } } catch (IOException e) { Logger.getLogger(PackageDiscoveryServiceImpl.class).warn("Could not read file: " + path + " due to: " + e.getMessage()); } } else if (Files.isRegularFile(path) && ZipUtil.endsWithZipExtension(path.toString())) { results.addAll(ZipUtil.scanZipFile(path, relativeOnly)); } return results; } }
public void trace(final String msg, final Object arg) { if (isTraceEnabled()) { log(Level.TRACE, format(msg, new Object[] { arg }), null); } }
public void debug(final String msg) { if (isDebugEnabled()) { log(Level.DEBUG, msg, null); } }
public RewritePhaseListener() { log.info(RewritePhaseListener.class.getSimpleName() + " starting up."); }
private static Object executeProviderCallable(Rewrite event, EvaluationContext context, ProviderCallable<Object> providerCallable) { List<Exception> exceptions = new ArrayList<Exception>(); for (ExpressionLanguageProvider provider : getProviders()) { try { return providerCallable.call(event, context, provider); } catch (RuntimeException e) { throw e; } catch (Exception e) { exceptions.add(e); } } for (Exception exception : exceptions) { log.error("DEFERRED EXCEPTION", exception); } throw new RewriteException("No registered " + ExpressionLanguageProvider.class.getName() + " could handle the Expression [" + providerCallable.getExpression() + "]"); }