Examples of ILoggerFactory


Examples of org.slf4j.ILoggerFactory

  public static final String LOCATION_PREFIX_CLASSPATH = "classpath:";

  @Override
  public void contextInitialized(final ServletContextEvent sce) {
    ServletContext sc = sce.getServletContext();
    ILoggerFactory ilc = LoggerFactory.getILoggerFactory();

    if (!(ilc instanceof LoggerContext)) {
      sc.log(new StringBuilder("Can not configure logback. ").append(LoggerFactory.class).append(" is using ").append(ilc)
          .append(" which is not an instance of ").append(LoggerContext.class).toString());
      return;
View Full Code Here

Examples of org.slf4j.ILoggerFactory

    }
  }

  @Override
  public void contextDestroyed(final ServletContextEvent sce) {
    ILoggerFactory ilc = LoggerFactory.getILoggerFactory();
    if (ilc instanceof LoggerContext) {
      LoggerContext lc = (LoggerContext) ilc;
      lc.stop();
    }
  }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

      Class factoryFactoryClass = Class.forName(getLoggerFactoryClassStr());
      Class[] EMPTY_CLASS_ARRAY = {};
      java.lang.reflect.Method factoryFactoryMethod = factoryFactoryClass
          .getDeclaredMethod(LOGGER_FACTORY_FACTORY_METHOD_NAME,
              EMPTY_CLASS_ARRAY);
      ILoggerFactory loggerFactory = (ILoggerFactory) factoryFactoryMethod
          .invoke(null, null);
      return loggerFactory;
    } catch (Exception e) {
      Util.reportFailure("Failed to fetch ILoggerFactory instnace using the "
          + factoryFactoryClassName + " class.", e);
View Full Code Here

Examples of org.slf4j.ILoggerFactory

      return;
    }

    // Now get logback to actually use the config file

    ILoggerFactory ilf = LoggerFactory.getILoggerFactory();
    if (!(ilf instanceof LoggerContext)) {
      // Not using LogBack.
      // Can't configure the logger, so just exit
      return;
    }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

  public void on(final NexusInitializedEvent evt) {
    configure();
  }

  private LoggerContext getLoggerContext() {
    ILoggerFactory factory = LoggerFactory.getILoggerFactory();
    if (factory instanceof LoggerContext) {
      return (LoggerContext) factory;
    }
    // temporary workaround for situations where SLF4j is not backed by logback
    return (LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory();
View Full Code Here

Examples of org.slf4j.ILoggerFactory

        configureInstrumentation(root, metricRegistry);
    }

    public void stop() {
        ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
        if (loggerFactory instanceof LoggerContext) {
            LoggerContext context = (LoggerContext) loggerFactory;
            context.stop();
        }
    }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

  private void flushLogs() {
    final long millisToWait = 100;

    LOG.info("Attempting to flush logs and wait {} ...", JavaUtils.durationFromMillis(millisToWait));

    ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
    if (loggerFactory instanceof LoggerContext) {
      LoggerContext context = (LoggerContext) loggerFactory;
      context.stop();
    }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

      } catch (Throwable t) {
        LOG.error("Exception thrown from service {}.", serviceName, t);
        throw Throwables.propagate(t);
      }
    } finally {
      ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
      if (loggerFactory instanceof LoggerContext) {
        ((LoggerContext) loggerFactory).stop();
      }
    }
  }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

    }
  }

  private void configureLogger() {
    // Check if SLF4J is bound to logback in the current environment
    ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
    if (!(loggerFactory instanceof LoggerContext)) {
      return;
    }

    LoggerContext context = (LoggerContext) loggerFactory;
View Full Code Here

Examples of org.slf4j.ILoggerFactory

*
*/
public final class Loggings {

  public static void forceFlush() {
    ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();

    if (loggerFactory instanceof LoggerContext) {
      Appender<ILoggingEvent> appender = ((LoggerContext) loggerFactory).getLogger(Logger.ROOT_LOGGER_NAME)
                                                                        .getAppender("KAFKA");
      if (appender != null && appender instanceof KafkaAppender) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.