Package org.apache.log4j.xml

Examples of org.apache.log4j.xml.DOMConfigurator.doConfigure()


         * 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


      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) {
View Full Code Here

  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

         DocumentBuilder builder = factory.newDocumentBuilder();
         Document doc = builder.parse(log4JConfig);
         DOMConfigurator conf = new DOMConfigurator();

         Hierarchy hierarchy = new Hierarchy(new RootCategory(Level.DEBUG));
         conf.doConfigure(doc.getDocumentElement(), hierarchy);
         repositories.put(classloader, hierarchy);
      }
      catch (Exception e)
      {
         log.error(e);
View Full Code Here

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

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

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


  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

      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

        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

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.