Examples of LoggerRepository


Examples of org.apache.log4j.spi.LoggerRepository

     *                     otherwise
     * @param appender     the appender to use. Can be null.
     */
    public static void initializeLogging(boolean logToConsole,
                                         AppenderSkeleton appender) {
        LoggerRepository repos = LogManager.getLoggerRepository();
        if (!logToConsole) {
            String params;
            if (appender == null) {
                params = "OFF";
            } else {
                // Set the hierarchy's threshold to match the one and
                // only appender
                params = appender.getThreshold().toString();
            }
               
            repos.setThreshold(params);
        }
    }
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

      } else {
        plugin.setName(pluginName);
        logger.debug("plugin named as [" + pluginName + "]");
      }

      LoggerRepository repository = (LoggerRepository) ec.getObject(0);
     
      repository.getPluginRegistry().addPlugin(plugin);
      plugin.setLoggerRepository(repository);
     
      logger.debug("Pushing plugin on to the object stack.");
      ec.pushObject(plugin);
    } catch (Exception oops) {
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

 
  public void begin(ExecutionContext ec, String name, Attributes attributes) {
    inError = false;
    //logger.debug("In begin method");

    LoggerRepository repository = (LoggerRepository) ec.getObject(0);
    root = repository.getRootLogger();

    getLogger().debug("Pushing root logger on stack");
    ec.pushObject(root);
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

    if (
      (debugAttrib == null) || debugAttrib.equals("")
        || debugAttrib.equals("null")) {
      getLogger().debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
    } else {
      LoggerRepository repository = (LoggerRepository) ec.getObject(0);
      ConfiguratorBase.attachTemporaryConsoleAppender(repository);
      getLogger().debug("Starting internal logs on console.");
      attachment = true;
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

  }

  public void end(ExecutionContext ec, String name) {
    if (attachment) {
      getLogger().debug("Will stop writing internal logs on console.");
      LoggerRepository repository = (LoggerRepository) ec.getObject(0);
      List errorList = ec.getErrorList();
      ConfiguratorBase.detachTemporaryConsoleAppender(repository, errorList);
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

      throw new IllegalStateException(errMsg);
    }
  }
 
  public void setProperties(ExecutionContext ec, Properties props) {
    LoggerRepository repository = getLoggerRepository(ec);
    repository.getProperties().putAll(props);
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

    LoggerRepository repository = getLoggerRepository(ec);
    repository.getProperties().putAll(props);
  }
 
  public void setProperty(ExecutionContext ec, String key, String value) {
    LoggerRepository repository = getLoggerRepository(ec);
    repository.setProperty(key, value);
 
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

 
  public void begin(ExecutionContext ec, String name, Attributes attributes) {
    // Let us forget about previous errors (in this object)
    inError = false;

    LoggerRepository repository = (LoggerRepository) ec.getObject(0);

    // Create a new org.apache.log4j.Category object from the <category> element.
    String loggerName = attributes.getValue(NAME_ATTRIBUTE);

    if (Option.isEmpty(loggerName)) {
      inError = true;

      String line =
        ", around line " + getLineNumber(ec) + " column "
        + getColumnNumber(ec);

      String errorMsg = "No 'name' attribute in element " + name + line;

      logger.warn(errorMsg);
      ec.addError(new ErrorItem(errorMsg));

      return;
    }

    logger.debug("Logger name is [" + loggerName + "].");

    Logger l;

    String className = attributes.getValue(CLASS_ATTRIBUTE);

    if (Option.isEmpty(className)) {
      logger.debug("Retreiving an instance of org.apache.log4j.Logger.");
      l = repository.getLogger(loggerName);
    } else {
      logger.debug("Desired logger sub-class: [" + className + ']');

      try {
        Class clazz = Loader.loadClass(className);
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

   
    String configFile = args[4];

    if(configFile.endsWith(".xml")) {
      JoranConfigurator jc = new JoranConfigurator();
      LoggerRepository repository = LogManager.getLoggerRepository();
      jc.doConfigure(configFile, repository);
    } else {
      PropertyConfigurator.configure(configFile);
    }
   
View Full Code Here

Examples of org.apache.log4j.spi.LoggerRepository

      logger.debug(
        "About to detach logger context named [" + loggingContextName + "].");

      RepositorySelector repositorySelector =
        LogManager.getRepositorySelector();
      LoggerRepository lr = repositorySelector.detachRepository(loggingContextName);
      if(lr != null) {
        logger.debug("About to shutdown logger repository named ["+lr.getName()+
            "]");
        lr.shutdown();
      }
    }
  }
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.