Package org.apache.log4j

Examples of org.apache.log4j.Hierarchy


  LoggerRepository  genericHierarchy() {
    if(genericHierarchy == null) {
      File f = new File(dir, GENERIC+CONFIG_FILE_EXT);
      if(f.exists()) {
  genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
  new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy);
      } else {
  cat.warn("Could not find config file ["+f+
     "]. Will use the default hierarchy.");
  genericHierarchy = LogManager.getLoggerRepository();
View Full Code Here


   * Performs any necessary initialisation.
   */
  private void init() {
    if (appender == null) {
      // need to create a new log4j hierarchy so values in log4j.xml are ignored
      observerLogger = new Hierarchy(new RootLogger(Level.DEBUG)).getLogger(this.getClass().getName());
      PatternLayout layout = new PatternLayout();
      layout.setConversionPattern(conversionPattern);
      try {
        appender = new RollingFileAppender(layout, baseLogPath + jobRunId + ".log");
        appender.setMaxBackupIndex(maxBackupIndex);
View Full Code Here

                    LOG4J_CONFIG_FILE_DEFAULT);
            log4jFile = getRealPath(log4jFile);
            Properties p = new Properties();
            p.load(new FileInputStream(log4jFile));
            p.setProperty(APPLICATION_ROOT_KEY, context.getApplicationRoot());
            Hierarchy h = new Hierarchy(new RootCategory(Level.INFO));
            new PropertyConfigurator().doConfigure(p,h);
            IsolatedLog4JLogger.setHierarchy(h);
           
            log.info("Configured log4j from " + log4jFile);
            log.info("Starting Jetspeed Engine ("+getClass().getName()+") at "+format.format(startTime));
View Full Code Here

/*     */     }
/* 175 */     String key = s.substring(0, i);
/*     */
/* 177 */     File configFile = new File(this.dir, key + CONFIG_FILE_EXT);
/* 178 */     if (configFile.exists()) {
/* 179 */       Hierarchy h = new Hierarchy(new RootLogger((Level)Priority.DEBUG));
/* 180 */       this.hierarchyMap.put(inetAddress, h);
/*     */
/* 182 */       new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);
/*     */
/* 184 */       return h;
View Full Code Here

/*     */   LoggerRepository genericHierarchy()
/*     */   {
/* 193 */     if (this.genericHierarchy == null) {
/* 194 */       File f = new File(this.dir, GENERIC + CONFIG_FILE_EXT);
/* 195 */       if (f.exists()) {
/* 196 */         this.genericHierarchy = new Hierarchy(new RootLogger((Level)Priority.DEBUG));
/* 197 */         new PropertyConfigurator().doConfigure(f.getAbsolutePath(), this.genericHierarchy);
/*     */       } else {
/* 199 */         cat.warn("Could not find config file [" + f + "]. Will use the default hierarchy.");
/*     */
/* 201 */         this.genericHierarchy = LogManager.getLoggerRepository();
View Full Code Here

                    LOG4J_CONFIG_FILE_DEFAULT);
            log4jFile = getRealPath(log4jFile);
            Properties p = new Properties();
            p.load(new FileInputStream(log4jFile));
            p.setProperty(APPLICATION_ROOT_KEY, context.getApplicationRoot());
            Hierarchy h = new Hierarchy(new RootCategory(Level.INFO));
            new PropertyConfigurator().doConfigure(p,h);
            IsolatedLog4JLogger.setHierarchy(h);
           
            log.info("Configured log4j from " + log4jFile);
            log.info("Starting Jetspeed Engine ("+getClass().getName()+") at "+format.format(startTime));
View Full Code Here

            theSelector = new MyRepositorySelector();
            LogManager.setRepositorySelector(theSelector, null);
            initialized = true;
        }

        Hierarchy hierarchy = new Hierarchy(new RootCategory(Level.ERROR));

        loadLog4JConfig(config, hierarchy);
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        repositories.put(loader, hierarchy);
    }
View Full Code Here

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

   {
      if (classloader == null)
      {
         throw new IllegalArgumentException("No classloader provided");
      }
      Hierarchy hierarchy = (Hierarchy)repositories.remove(classloader);
      if (hierarchy != null)
      {
         hierarchy.shutdown();
      }
      else
      {
         System.out.print("No hierarchy found for classloader : ");
         Writer writer = new PrintWriter(System.out);
View Full Code Here

TOP

Related Classes of org.apache.log4j.Hierarchy

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.