Examples of DOMConfigurator


Examples of org.apache.log4j.xml.DOMConfigurator

    /**
     * Static method to change the Log4j config globally.
     * @param xmlConfig The text of a Log4j config file.
     */
    public static void configure(String xmlConfig) {
        DOMConfigurator configurator = new DOMConfigurator();
        StringReader sr = new StringReader(xmlConfig);
        configurator.doConfigure(sr, LogManager.getLoggerRepository());
    }
View Full Code Here

Examples of org.apache.log4j.xml.DOMConfigurator

   
   
    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

Examples of org.apache.log4j.xml.DOMConfigurator

      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

Examples of org.apache.log4j.xml.DOMConfigurator

   }

   static String DIR_PREFIX = "src/test/java/ch/qos/logback/classic/issue/lbcore243/";

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

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

Examples of org.apache.log4j.xml.DOMConfigurator

   * 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

Examples of org.apache.log4j.xml.DOMConfigurator

   *
   * 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

Examples of org.apache.log4j.xml.DOMConfigurator

    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

Examples of org.apache.log4j.xml.DOMConfigurator

      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

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
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.