Examples of DOMConfigurator


Examples of org.apache.log4j.xml.DOMConfigurator

            newElement.appendChild( newNode );
        }

        document.appendChild( newElement );

        /**
         * Copied from org.apache.log4j.xml.DomConfigurator configure().
         * We want our own hierarchy to be configured, so we shall
         * be a bit more elaborate then just calling configure().
         */
        final DOMConfigurator domConfigurator = new DOMConfigurator();
        domConfigurator.doConfigure( newElement, m_hierarchy );
    }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

                final ClassLoader current = SecurityActions.getThreadContextClassLoader();
                final LogContext old = LoggingExtension.THREAD_LOCAL_CONTEXT_SELECTOR.getAndSet(CONTEXT_LOCK, logContext);
                try {
                    SecurityActions.setThreadContextClassLoader(classLoader);
                    if (LOG4J_XML.equals(fileName) || JBOSS_LOG4J_XML.equals(fileName)) {
                        new DOMConfigurator().doConfigure(configStream, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
                    } else {
                        final Properties properties = new Properties();
                        properties.load(new InputStreamReader(configStream, ENCODING));
                        new org.apache.log4j.PropertyConfigurator().doConfigure(properties, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
                    }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

   * @param prefix
   */
  public Log4JConfigurator(String prefix) {
    this.prefix = prefix;
    props.setProperty(CONTEXT_ROOT_VARIABLE, prefix);
    domConfig = new DOMConfigurator() {

      /*
       * (non-Javadoc)
       *
       * @see org.apache.log4j.xml.DOMConfigurator#subst(java.lang.String)
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

   * Load the log4j xml configuration file.  If the user does not supply a
   * configuration file load the sample configuration.
   * @param configFile The configuration filename.
   */
  private static void loadConfiguration(String configFile) {
    DOMConfigurator domConfigurator = new DOMConfigurator();
    if (configFile == null) {
      ClassLoader loader = ClassLoader.getSystemClassLoader ();   
      String resourceName = "com/volantis/mcs/cli/"
  + "marinerSocketServer-log4j.xml";
      try {
  InputStream inputStream = loader.getResourceAsStream (resourceName);
  if (inputStream != null) {
    domConfigurator.doConfigure(inputStream, cat.getDefaultHierarchy());
  } else {
    doError("An error occured loading the default configuration");
  }
      }
      catch (Exception e) {
  doError("An error occured loading the default configuration");
      }
    } else {
      try {
  FileInputStream fis = new FileInputStream(configFile);
  domConfigurator.doConfigure(fis, cat.getDefaultHierarchy());
      }
      catch (FileNotFoundException e) {
  doError("Configuration File not found: " + configFile);
      }
      catch (Exception e) {
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

    // Force a reset on the logger's configuration
    LogManager.resetConfiguration();
    if (usingProperties) {
      new PropertyConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
    } else {
      new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
    }
  }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

    protected void configureFrom(URL url, LoggerRepository repository)
    {
        if (url.toExternalForm().endsWith(".xml"))
        {
            new DOMConfigurator().doConfigure(url, repository);
        }
        else
        {
            new PropertyConfigurator().doConfigure(url, repository);
        }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

            {
                logger.info("Reconfiguring logging from: " + filename);
            }
            if (filename.endsWith(".xml"))
            {
                new DOMConfigurator().doConfigure(filename, repository);
            }
            else
            {
                new PropertyConfigurator().doConfigure(filename, repository);
            }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

  }
 
  private void resetLogger() {
    // Force a reset on the logger's configuration
    LogManager.resetConfiguration();
    new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
  }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

        } catch (IOException e) {
            log.warn("Could not determine content type from URL; ignoring", e);
        }
        if (contentType != null) {
            if (contentType.toLowerCase().endsWith("/xml")) {
                return new DOMConfigurator();
            }
        }

        // Check thr file name
        String filename = url.getFile().toLowerCase();
        if (filename.endsWith(".xml")) {
            return new DOMConfigurator();
        } else if (filename.endsWith(".properties")) {
            return new PropertyConfigurator();
        }

        // Check for <?xml in content
        if (connection != null) {
            try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                try {
                    String head = reader.readLine();
                    if (head.startsWith("<?xml")) {
                        return new DOMConfigurator();
                    }
                } finally {
                    reader.close();
                }
            } catch (IOException e) {
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

      }
    } else {
      String filename = url.getFile();
      if(filename != null && filename.endsWith(".xml")) {
  try {
    configurator = new DOMConfigurator();
  } catch(NoClassDefFoundError e) {
    LogLog.warn("Could not find DOMConfigurator!", e);
    return;
  }
      } else {
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.