Package org.apache.log4j.xml

Examples of org.apache.log4j.xml.DOMConfigurator


     */
    public PluginLogManager(Plugin plugin, URL xmlProperties) {
        fLog = plugin.getLog();
        fHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
        fHierarchy.addHierarchyEventListener(new LogListener());
        new DOMConfigurator().doConfigure(xmlProperties, fHierarchy);

        PluginLogManagerRegistry.getInstance().addLogManager(this);
    }
View Full Code Here


      {
         log4JConfig = loader.load(pathToLog4jFile);
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         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

        } 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

      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

        replacements.put("libreplan-log-directory",
                findLogDirectory(sce.getServletContext()));
        try {
            StringReader newConfiguration = new StringReader(
                    getContents(replacements));
            new DOMConfigurator().doConfigure(newConfiguration,
                    LogManager.getLoggerRepository());
        } catch (IOException e) {
            e.printStackTrace();
            // let log4j be loaded without replacements
        }
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

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

   
   
    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

   }

   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

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.