org.ocpsoft.logging.Logger类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(266)

本文整理了Java中org.ocpsoft.logging.Logger类的一些代码示例,展示了Logger类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger类的具体详情如下:
包路径:org.ocpsoft.logging.Logger
类名称:Logger

Logger介绍

[英]Class to create log messages.
[中]类来创建日志消息。

代码示例

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public void perform(Rewrite event, EvaluationContext context)
  3. {
  4. String message = messageBuilder.build(event, context);
  5. switch (level)
  6. {
  7. case TRACE:
  8. if (log.isTraceEnabled())
  9. log.trace(message);
  10. break;
  11. case DEBUG:
  12. if (log.isDebugEnabled())
  13. log.debug(message);
  14. break;
  15. case INFO:
  16. if (log.isInfoEnabled())
  17. log.info(message);
  18. break;
  19. case WARN:
  20. if (log.isWarnEnabled())
  21. log.warn(message);
  22. break;
  23. case ERROR:
  24. if (log.isErrorEnabled())
  25. log.error(message);
  26. break;
  27. default:
  28. break;
  29. }
  30. }

代码示例来源:origin: org.ocpsoft.logging/logging-api

  1. /**
  2. * Create a {@link Logger} instance for a specific class
  3. *
  4. * @param clazz The class to create the log for
  5. * @return The {@link Logger} instance
  6. */
  7. public static Logger getLogger(final Class<?> clazz)
  8. {
  9. return getLogger(clazz.getName());
  10. }

代码示例来源:origin: ocpsoft/rewrite

  1. public void trace(final String msg)
  2. {
  3. if (isTraceEnabled())
  4. {
  5. log(Level.TRACE, msg, null);
  6. }
  7. }

代码示例来源:origin: ocpsoft/rewrite

  1. public void info(final String msg, final Object[] argArray)
  2. {
  3. if (isInfoEnabled())
  4. {
  5. log(Level.INFO, format(msg, argArray), null);
  6. }
  7. }

代码示例来源:origin: ocpsoft/rewrite

  1. public void info(final String msg)
  2. {
  3. if (isInfoEnabled())
  4. {
  5. log(Level.INFO, msg, null);
  6. }
  7. }

代码示例来源:origin: ocpsoft/rewrite

  1. protected void closeQuietly(Closeable closeable)
  2. {
  3. try
  4. {
  5. closeable.close();
  6. }
  7. catch (IOException e)
  8. {
  9. logger.warn(e.getMessage(), e);
  10. }
  11. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-integration-spring

  1. @Override
  2. public <T> void enrich(final T service)
  3. {
  4. SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(service);
  5. if (log.isDebugEnabled())
  6. log.debug("Enriched instance of service [" + service.getClass().getName() + "]");
  7. }

代码示例来源:origin: ocpsoft/rewrite

  1. private void checkConfLocal(final Conf conf)
  2. {
  3. if (conf.isOk() && conf.isEngineEnabled()) {
  4. urlRewriter = new UrlRewriter(conf);
  5. log.debug("Tuckey UrlRewriteFilter configuration loaded (Status: OK)");
  6. }
  7. else {
  8. if (!conf.isOk()) {
  9. log.error("Tuckey UrlRewriteFilter configuration failed (Status: ERROR)");
  10. }
  11. if (!conf.isEngineEnabled()) {
  12. log.warn("Tuckey UrlRewriteFilter engine explicitly disabled in configuration");
  13. }
  14. if (urlRewriter != null) {
  15. log.debug("Tuckey UrlRewriteFilter configuration unloaded");
  16. urlRewriter = null;
  17. }
  18. }
  19. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-impl

  1. @Override
  2. public Object getInstance(Class<?> type)
  3. {
  4. Object result = null;
  5. try {
  6. result = type.newInstance();
  7. }
  8. catch (Exception e) {
  9. log.debug("Could not create instance of type [" + type.getName() + "] through reflection.", e);
  10. }
  11. return result;
  12. }

代码示例来源:origin: ocpsoft/rewrite

  1. if (log.isDebugEnabled())
  2. log.debug("Processing JAR file: " + jarUrl.toString());
  3. log.error("Failed to read JAR file: " + jarUrl.toString(), e);

代码示例来源:origin: ocpsoft/rewrite

  1. if (log.isTraceEnabled()) {
  2. log.trace("Service provider [{}] returned [{}] for class [{}]", new Object[] {
  3. resolver.getClass().getSimpleName(), beanName, clazz.getName()
  4. });
  5. .toString();
  6. if (log.isTraceEnabled()) {
  7. log.debug("Creation of EL expression for component [{}] of class [{}] successful: {}", new Object[] {
  8. component, clazz.getName(), el
  9. });

代码示例来源:origin: ocpsoft/rewrite

  1. /**
  2. * Process one {@link AnnotatedElement} of the class.
  3. */
  4. private void visit(AnnotatedElement element, ClassContext context)
  5. {
  6. List<AnnotationHandler<Annotation>> elementHandlers = new ArrayList<AnnotationHandler<Annotation>>();
  7. // check if any of the handlers is responsible
  8. for (AnnotationHandler<Annotation> handler : handlerList)
  9. {
  10. // each annotation on the element may be interesting for us
  11. for (Annotation annotation : element.getAnnotations())
  12. {
  13. if (handler.handles().equals(annotation.annotationType()))
  14. {
  15. elementHandlers.add(handler);
  16. }
  17. }
  18. }
  19. if (!elementHandlers.isEmpty())
  20. {
  21. if (log.isTraceEnabled())
  22. {
  23. log.trace("Executing handler chain on " + element + ": " + elementHandlers);
  24. }
  25. // execute the handler chain
  26. new HandlerChainImpl(context, element, elementHandlers).proceed();
  27. }
  28. }

代码示例来源:origin: org.ocpsoft.logging/logging-api

  1. public void debug(final String msg, final Object arg)
  2. {
  3. if (isDebugEnabled())
  4. {
  5. log(Level.DEBUG, format(msg, new Object[] { arg }), null);
  6. }
  7. }

代码示例来源:origin: ocpsoft/rewrite

  1. log.debug("Error", e);
  2. log.error("unable to find urlrewrite conf file at " + confPath);
  3. log.error("unloading existing conf");
  4. urlRewriter = null;

代码示例来源:origin: org.jboss.windup.web.addons/windup-web-support-impl

  1. private static List<String> findPaths(Path path, boolean relativeOnly)
  2. {
  3. List<String> results = new ArrayList<>();
  4. results.add(path.normalize().toAbsolutePath().toString());
  5. if (Files.isDirectory(path))
  6. {
  7. try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path))
  8. {
  9. for (Path child : directoryStream)
  10. {
  11. results.addAll(findPaths(child, relativeOnly));
  12. }
  13. }
  14. catch (IOException e)
  15. {
  16. Logger.getLogger(PackageDiscoveryServiceImpl.class).warn("Could not read file: " + path + " due to: " + e.getMessage());
  17. }
  18. }
  19. else if (Files.isRegularFile(path) && ZipUtil.endsWithZipExtension(path.toString()))
  20. {
  21. results.addAll(ZipUtil.scanZipFile(path, relativeOnly));
  22. }
  23. return results;
  24. }
  25. }

代码示例来源:origin: org.ocpsoft.logging/logging-api

  1. public void trace(final String msg, final Object arg)
  2. {
  3. if (isTraceEnabled())
  4. {
  5. log(Level.TRACE, format(msg, new Object[] { arg }), null);
  6. }
  7. }

代码示例来源:origin: ocpsoft/rewrite

  1. public class AnnotationConfigProvider extends HttpConfigurationProvider
  2. private final Logger log = Logger.getLogger(AnnotationConfigProvider.class);
  3. log.debug("Annotation scanning is disabled!");
  4. return null;

代码示例来源:origin: org.ocpsoft.logging/logging-api

  1. public void debug(final String msg)
  2. {
  3. if (isDebugEnabled())
  4. {
  5. log(Level.DEBUG, msg, null);
  6. }
  7. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-integration-faces

  1. public RewritePhaseListener()
  2. {
  3. log.info(RewritePhaseListener.class.getSimpleName() + " starting up.");
  4. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-api-el

  1. private static Object executeProviderCallable(Rewrite event, EvaluationContext context,
  2. ProviderCallable<Object> providerCallable)
  3. {
  4. List<Exception> exceptions = new ArrayList<Exception>();
  5. for (ExpressionLanguageProvider provider : getProviders()) {
  6. try
  7. {
  8. return providerCallable.call(event, context, provider);
  9. }
  10. catch (RuntimeException e) {
  11. throw e;
  12. }
  13. catch (Exception e)
  14. {
  15. exceptions.add(e);
  16. }
  17. }
  18. for (Exception exception : exceptions) {
  19. log.error("DEFERRED EXCEPTION", exception);
  20. }
  21. throw new RewriteException("No registered " + ExpressionLanguageProvider.class.getName()
  22. + " could handle the Expression [" + providerCallable.getExpression() + "]");
  23. }

相关文章