Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.Configurator


        if (log.isDebugEnabled()) {
            log.debug("Configuring from URL: " + url);
        }

        // Get the config delegate and target repository to config with
        Configurator delegate = null;
        try {
            delegate = getConfigurator(url);
        } catch (FileNotFoundException e) {
            return;
        }

        if (log.isTraceEnabled()) {
            log.trace("Configuring Log4j using configurator: " +
                    delegate + ", repository: " + repo);
        }

        // Now actually configure Log4j
        delegate.doConfigure(url, repo);
    }
View Full Code Here


     @param hierarchy The {@link org.apache.log4j.Hierarchy} to act on.

     @since 1.1.4 */
  public static void selectAndConfigure(
    URL url, String clazz, LoggerRepository repository) {
    Configurator configurator = null;
    String filename = url.getFile();

    if ((clazz == null) && (filename != null) && filename.endsWith(".xml")) {
      clazz = JoranConfigurator.class.getName();
    }

    if (clazz != null) {
      Logger logger = repository.getLogger(OptionConverter.class.getName());
      logger.info("Preferred configurator class: " + clazz);

      configurator =
        (Configurator) instantiateByClassName(clazz, Configurator.class, null);

      if (configurator == null) {
        logger.error("Could not instantiate configurator [" + clazz + "].");
       
        return;
      }
    } else {
      configurator = new PropertyConfigurator();
    }
   
    configurator.doConfigure(url, repository);
    if(configurator instanceof ConfiguratorBase) {
      ((ConfiguratorBase)configurator).dumpErrors();
    }
  }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Configuring from URL: " + url);
        }

        // Get the config delegate and target repository to config with
        Configurator delegate = null;
        try {
            delegate = getConfigurator(url);
        } catch (FileNotFoundException e) {
            return;
        }

        if (log.isTraceEnabled()) {
            log.trace("Configuring Log4j using configurator: " +
                    delegate + ", repository: " + repo);
        }

        // Now actually configure Log4j
        delegate.doConfigure(url, repo);
    }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Configuring from URL: " + url);
        }

        // Get the config delegate and target repository to config with
        Configurator delegate = null;
        try {
            delegate = getConfigurator(url);
        } catch (FileNotFoundException e) {
            return;
        }

        if (log.isTraceEnabled()) {
            log.trace("Configuring Log4j using configurator: " +
                    delegate + ", repository: " + repo);
        }

        // Now actually configure Log4j
        delegate.doConfigure(url, repo);
    }
View Full Code Here

            if (log.isDebugEnabled()) {
                log.debug("Configuring from URL: " + url);
            }

            // Get the config delegate and target repository to config with
            Configurator delegate = null;
            try {
                delegate = getConfigurator(url);
            } catch (FileNotFoundException e) {
                return;
            }

            if (log.isTraceEnabled()) {
                log.trace("Configuring Log4j using configurator: " +
                        delegate + ", repository: " + repo);
            }

            // Now actually configure Log4j
            delegate.doConfigure(url, repo);
        } catch (Throwable e) {
            log.info("conld not configure log4j", e);
        }
    }
View Full Code Here

     @since 1.1.4 */

  static
  public
  void selectAndConfigure(URL url, String clazz, LoggerRepository hierarchy) {
   Configurator configurator = null;
   String filename = url.getFile();

   if(clazz == null && filename != null && filename.endsWith(".xml")) {
     clazz = "org.apache.log4j.xml.DOMConfigurator";
   }

   if(clazz != null) {
     LogLog.debug("Preferred configurator class: " + clazz);
     configurator = (Configurator) instantiateByClassName(clazz,
                Configurator.class,
                null);
     if(configurator == null) {
       LogLog.error("Could not instantiate configurator ["+clazz+"].");
       return;
     }
   } else {
     configurator = new PropertyConfigurator();
   }

   configurator.doConfigure(url, hierarchy);
  }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Configuring from URL: " + url);
        }

        // Get the config delegate and target repository to config with
        Configurator delegate = null;
        try {
            delegate = getConfigurator(url);
        } catch (FileNotFoundException e) {
            return;
        }

        if (log.isTraceEnabled()) {
            log.trace("Configuring Log4j using configurator: " +
                    delegate + ", repository: " + repo);
        }

        // Now actually configure Log4j
        delegate.doConfigure(url, repo);
    }
View Full Code Here

     @since 1.1.4 */

  static
  public
  void selectAndConfigure(URL url, String clazz, LoggerRepository hierarchy) {
   Configurator configurator = null;
   String filename = url.getFile();

   if(clazz == null && filename != null && filename.endsWith(".xml")) {
     clazz = "org.apache.log4j.xml.DOMConfigurator";
   }

   if(clazz != null) {
     LogLog.debug("Preferred configurator class: " + clazz);
     configurator = (Configurator) instantiateByClassName(clazz,
                Configurator.class,
                null);
     if(configurator == null) {
       LogLog.error("Could not instantiate configurator ["+clazz+"].");
       return;
     }
   } else {
     configurator = new PropertyConfigurator();
   }

   configurator.doConfigure(url, hierarchy);
  }
View Full Code Here

     @param hierarchy The {@link org.apache.log4j.Hierarchy} to act on.

     @since 1.1.4 */
  public static void selectAndConfigure(
    URL url, String clazz, LoggerRepository hierarchy) {
    Configurator configurator = null;
    String filename = url.getFile();

    if ((clazz == null) && (filename != null) && filename.endsWith(".xml")) {
      clazz = "org.apache.log4j.joran.JoranConfigurator";
    }

    if (clazz != null) {
      getLogger().info("Preferred configurator class: " + clazz);
      configurator =
        (Configurator) instantiateByClassName(clazz, Configurator.class, null);

      if (configurator == null) {
        getLogger().error("Could not instantiate configurator [" + clazz + "].");

        return;
      }
    } else {
      configurator = new PropertyConfigurator();
    }

    configurator.doConfigure(url, hierarchy);
  }
View Full Code Here

     @since 1.1.4 */
    
  static
  public
  void selectAndConfigure(URL url, String clazz, LoggerRepository hierarchy) {
   Configurator configurator = null;
   String filename = url.getFile();
  
   if(clazz == null && filename != null && filename.endsWith(".xml")) {
     clazz = "org.apache.log4j.xml.DOMConfigurator";
   }
  
   if(clazz != null) {
     LogLog.debug("Preferred configurator class: " + clazz);
     configurator = (Configurator) instantiateByClassName(clazz,
                Configurator.class,
                null);
     if(configurator == null) {
       LogLog.error("Could not instantiate configurator ["+clazz+"].");
       return;
     }
   } else {
     configurator = new PropertyConfigurator();
   }
  
   configurator.doConfigure(url, hierarchy);
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.Configurator

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.