Examples of ILoggerFactory


Examples of org.slf4j.ILoggerFactory

        if (checkForHelp && hasOption('h')) {
            printHelp(cliOptions, true, out);
        }

        ILoggerFactory lf = LoggerFactory.getILoggerFactory();

        JoranConfigurator jc = new JoranConfigurator();
        jc.setContext((Context) lf);
        try {
            InputStream is = getClass().getResourceAsStream(SLF4J_LOGGER_FILE);
            jc.doConfigure(is);
        } catch (JoranException e) {
            String msg = format(ERROR_INIT_LOGGING, e.getMessage());
            err.println(msg);
        }

        cliLogger = lf.getLogger(Logger.ROOT_LOGGER_NAME);
        ((ch.qos.logback.classic.Logger) cliLogger).detachAppender("console");

        reportable = null;
    }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

        initLogger();
    }

    protected void initLogger()
    {
        ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();
        logger = loggerFactory.getLogger("org.eclipse.jetty");
    }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

      LOG.info("Service {} completed.", serviceName);
    } catch (Throwable t) {
      LOG.warn("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

                System
                    .getProperty("rocketmq.client.logback.resource.fileName", "logback_rocketmq_client.xml");

        if (isloadconfig) {
            try {
                ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();
                Class classType = iLoggerFactory.getClass();
                if (classType.getName().equals("org.slf4j.impl.Log4jLoggerFactory")) {
                    Class<?> DOMConfigurator = null;
                    Object DOMConfiguratorObj = null;
                    DOMConfigurator = Class.forName("org.apache.log4j.xml.DOMConfigurator");
                    DOMConfiguratorObj = DOMConfigurator.newInstance();
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 setLogLevel(String loggerName, LogLevel level) {
    getLogger(loggerName).setLevel(LEVELS.get(level));
  }

  private LoggerContext getLoggerContext() {
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    Assert.isInstanceOf(
        LoggerContext.class,
        factory,
        String.format(
            "LoggerFactory is not a Logback LoggerContext but Logback is on "
                + "the classpath. Either remove Logback or the competing "
                + "implementation (%s loaded from %s).",
            factory.getClass(), factory.getClass().getProtectionDomain()
                .getCodeSource().getLocation()));

    return (LoggerContext) factory;
  }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

    return (LoggerContext) factory;
  }

  private ch.qos.logback.classic.Logger getLogger(String name) {
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    return (ch.qos.logback.classic.Logger) factory.getLogger(StringUtils
        .isEmpty(name) ? Logger.ROOT_LOGGER_NAME : name);

  }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

    }
  }

  private static class Initializer {
    public void setRootLogLevel() {
      ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
      Logger logger = factory.getLogger(Logger.ROOT_LOGGER_NAME);
      ((ch.qos.logback.classic.Logger) logger).setLevel(Level.INFO);
    }
View Full Code Here

Examples of org.slf4j.ILoggerFactory

  }

  @Test
  public void testBasicConfigLocation() throws Exception {
    this.loggingSystem.beforeInitialize();
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    LoggerContext context = (LoggerContext) factory;
    Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    assertNotNull(root.getAppender("CONSOLE"));
  }
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.