Package org.apache.log4j.xml

Examples of org.apache.log4j.xml.DOMConfigurator


   static void initLog4jWithoutImmediateFlush() {
     DOMConfigurator domConfigurator = new DOMConfigurator();
     domConfigurator.configure(DIR_PREFIX+"log4j_without_immediateFlush.xml");
   }
   static void initLog4jWithImmediateFlush() {
     DOMConfigurator domConfigurator = new DOMConfigurator();
     domConfigurator.configure(DIR_PREFIX+"log4j_with_immediateFlush.xml");
   }
View Full Code Here


   * DB related information is specified within the configuration files.
   * @throws Exception
   */
  public void testSingleOutput()
         throws Exception {
    DOMConfigurator jc1 = new DOMConfigurator();
    InputStream is = FullCycleDBTest.class.getResourceAsStream(appendConfigFile);
    jc1.doConfigure(is, lrWrite);
    is.close();
 
    long startTime = System.currentTimeMillis();
    System.out.println("***startTime is  "+startTime);

View Full Code Here

   *
   * DB related information is specified within the configuration files.
   * @throws Exception
   */
  public void testAllFields() throws IOException {
    DOMConfigurator jc1 = new DOMConfigurator();
    InputStream is = FullCycleDBTest.class.getResourceAsStream(appendConfigFile);
    jc1.doConfigure(is, lrWrite);
    is.close();
 
    long startTime = System.currentTimeMillis();
   
    // Write out just one log message
View Full Code Here

    readBack(readConfigFile, startTime);
  }


  void readBack(String configfile, long startTime) throws IOException {
    DOMConfigurator jc2 = new DOMConfigurator();
    InputStream is = FullCycleDBTest.class.getResourceAsStream(configfile);
    jc2.doConfigure(is, lrRead);
    is.close();
   
    // wait a little to allow events to be read
    try { Thread.sleep(3100); } catch(Exception e) {}
    VectorAppender va = (VectorAppender) lrRead.getRootLogger().getAppender("VECTOR");
View Full Code Here

      text = StringUtil.replace(text, LOGDIR_MACRO, StringUtil.replace(LOG_DIR, "\\", "\\\\"));

      File file = new File(PathManager.getSystemPath() + File.separator + LOG_DIR);
      file.mkdirs();

      DOMConfigurator domConfigurator = new DOMConfigurator();
      try {
        domConfigurator.doConfigure(new StringReader(text), LogManager.getLoggerRepository());
      }
      catch (ClassCastException e) {
        // shit :-E
        System.out.println("log.xml content:\n" + text);
        throw e;
View Full Code Here

        } 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

  }

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

        if (stream == null) {
            stream = this.getClass().getResourceAsStream("/log4j.xml");
            LOG.warn("Couldn't find outside log4j configuration, using internal");
        }
        DOMConfigurator configurator = new DOMConfigurator();
        configurator.doConfigure(stream, LogManager.getLoggerRepository());
        LOG.info("Logging configured.");
    }
View Full Code Here

   
   
    String configFile = args[4];

    if(configFile.endsWith(".xml")) {
      new DOMConfigurator().configure(configFile);
    } else {
      new PropertyConfigurator().configure(configFile);
    }
   
    new JMSSink(tcfBindingName, topicBindingName, username, password);
View Full Code Here

      e.printStackTrace();
      usage("Could not interpret port number ["+ portStr +"].");
    }
  
    if(configFile.endsWith(".xml")) {
      new DOMConfigurator().configure(configFile);
    } else {
      new PropertyConfigurator().configure(configFile);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.xml.DOMConfigurator

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.