Package org.slf4j

Examples of org.slf4j.ILoggerFactory


        for (SyncopeLogger syncopeLogger : loggerDAO.findAll(SyncopeLoggerType.AUDIT)) {
            loggerLogs.put(syncopeLogger.getName(), syncopeLogger);
        }

        ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();

        LoggerContext lc = (LoggerContext) loggerFactory;

        /*
         * Traverse all defined Logback loggers: if there is a matching SyncopeLogger, set Logback level accordingly,
View Full Code Here


            setLogLevel(entry.getName(), entry.getLevel());
        }
    }

    public void setLogLevel(String loggerName, Level level) {
        ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
        Logger slf4jLogger = factory.getLogger(StringUtils.isEmpty(loggerName) ? Logger.ROOT_LOGGER_NAME : loggerName);
        ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) slf4jLogger;
        logger.setLevel(level);
    }
View Full Code Here

      } 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

    }
  }

  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

public class MavenSlf4jSimpleFriend
{
    public static void init()
    {
        SimpleLogger.init();
        ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
        if ( loggerFactory instanceof SimpleLoggerFactory )
        {
            ( (SimpleLoggerFactory) loggerFactory ).reset();
        }
    }
View Full Code Here

        configurator.setContext(getLoggerContext(props));
        configurator.doConfigure(configFile);
    }

    private LoggerContext getLoggerContext(Map<String, String> props) {
        ILoggerFactory lcObject = LoggerFactory.getILoggerFactory();

        if (!(lcObject instanceof LoggerContext)) {
            throw new LogbackException(
                    "Expected LOGBACK binding with SLF4J, but another log system has taken the place: "
                            + lcObject.getClass().getSimpleName());
        }

        LoggerContext lc = (LoggerContext) lcObject;

        lc.reset();
View Full Code Here

        for (SyncopeLogger syncopeLogger : loggerDAO.findAll(SyncopeLoggerType.AUDIT)) {
            loggerLogs.put(syncopeLogger.getName(), syncopeLogger);
        }

        ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();

        LoggerContext lc = (LoggerContext) loggerFactory;

        /*
         * Traverse all defined Logback loggers: if there is a matching SyncopeLogger, set Logback level accordingly,
View Full Code Here

    }
  }

  private LoggerContext configureLogging(final String workerName, final String logDirectory) throws EngineException {

    final ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();

    if (iLoggerFactory instanceof Context) {
      final Context context = (Context) iLoggerFactory;
      final LoggerContext result = (LoggerContext) iLoggerFactory;
View Full Code Here

            log.error("InterruptedException while de-registering drivers.", e);
        }
    }

    private void shutDownLogger() {
        ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
        if (loggerFactory instanceof LoggerContext) {
            log.info("Shutting down LoggerContext");
            LoggerContext context = (LoggerContext) loggerFactory;
            context.stop();
        }
View Full Code Here

  public void initialize() {
    initialize(org.slf4j.Logger.ROOT_LOGGER_NAME);
  }

  public void initialize(String rootLoggerName) {
    ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
    if (!(loggerFactory instanceof LoggerContext)) {
      LOG.warn("LoggerFactory is not a logback LoggerContext. No log appender is added. " +
                 "Logback might not be in the classpath");
    }
View Full Code Here

TOP

Related Classes of org.slf4j.ILoggerFactory

Copyright © 2018 www.massapicom. 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.