Package org.apache.log4j

Examples of org.apache.log4j.PropertyConfigurator


        getLogger().error("Could not instantiate configurator [" + clazz + "].");

        return;
      }
    } else {
      configurator = new PropertyConfigurator();
    }

    configurator.doConfigure(url, hierarchy);
  }
View Full Code Here


         System.out.println("found assert method: "+m);
         // Find the log4j.properties file
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
         URL resURL = loader.getResource("log4j.properties");
         System.out.println("found log4j.properties: "+resURL);
         PropertyConfigurator config = new PropertyConfigurator();
         log = Category.getInstance(StatelessBean.class);
         config.configure(resURL);
      }
      catch(Throwable t)
      {
         t.printStackTrace();
         error = t;
View Full Code Here

         System.out.println("found assert method: "+m);
         // Find the log4j.properties file
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
         URL resURL = loader.getResource("log4j.properties");
         System.out.println("found log4j.properties: "+resURL);
         PropertyConfigurator config = new PropertyConfigurator();
         log = Category.getInstance(Log4jServlet.class);
         config.configure(resURL);

         // Try to access the java:comp/env context
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         System.out.println("Was able to lookup ENC");
View Full Code Here

        {
            new DOMConfigurator().doConfigure(url, repository);
        }
        else
        {
            new PropertyConfigurator().doConfigure(url, repository);
        }
    }
View Full Code Here

            {
                new DOMConfigurator().doConfigure(filename, repository);
            }
            else
            {
                new PropertyConfigurator().doConfigure(filename, repository);
            }
        }
View Full Code Here

     if(configurator == null) {
       LogLog.error("Could not instantiate configurator ["+clazz+"].");
       return;
     }
   } else {
     configurator = new PropertyConfigurator();
   }
  
   configurator.doConfigure(url, hierarchy);
  }
View Full Code Here

        // 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) {
                log.warn("Failed to check content header; ignoring", e);
            }
        }

        log.warn("Unable to determine content type, using property configurator");
        return new PropertyConfigurator();
    }
View Full Code Here

                {
                    waRootKey = LOG4J_CONFIG_WEB_APPLICATION_ROOT_KEY_DEFAULT;
                }
                p.setProperty(waRootKey,rootPath);
                isolatedHierarchy = new Hierarchy(new RootCategory(Level.INFO));
                new PropertyConfigurator().doConfigure(p,isolatedHierarchy);
                IsolatedLog4JLogger.setHierarchy(isolatedHierarchy);
                log = LogFactory.getLog(this.getClass());
                log.info("IsolatedLog4JLogger configured");
            }
            catch (IOException ioe)
View Full Code Here

  } catch(NoClassDefFoundError e) {
    LogLog.warn("Could not find DOMConfigurator!", e);
    return;
  }
      } else {
  configurator = new PropertyConfigurator();
      }
    }

    configurator.doConfigure(url, hierarchy);
  }
View Full Code Here

      if(configFile.exists()) {
  Hierarchy h = new Hierarchy(new RootCategory(Priority.DEBUG));
  hierarchyMap.put(inetAddress, h);
 
  try {
    new PropertyConfigurator().doConfigure(configFile.toURL(), h);
  } catch(MalformedURLException e) {
    cat.error("Could not convert"+configFile+" to a URL.", e);
  }
  return h; 
      } else {
View Full Code Here

TOP

Related Classes of org.apache.log4j.PropertyConfigurator

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.