[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: unable to find log4j.properties file in classpath

jaikiran do-not-reply at jboss.com
Mon Sep 8 11:34:22 EDT 2008


The PropertyConfigurator.configure(filename) expects an absolute filename path.

How about changing this piece of code:

"ashok.kadam" wrote : 
  | 
  |   | 
  |   | 	/**
  |   | 	 * Default BaseLogger Constructor. 
  |   | 	 */
  |   | 	private BaseLogger() {
  |   | 		PropertyConfigurator.configure("log4j.properties");
  |   | 		logLevel = DEFAULT_LOGLEVEL;
  |   | 	}
  |   | 
  |   | 

to:

  | private BaseLogger() {
  | 	Properties props = new Properties();
  | 
  | 	//load from classpath
  | 	InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("log4j.properties"); 
  | 	props.load(inputStream);
  | 
  | 	// Now pass these properties to PropertyConfigurator
  | 	PropertyConfigurator.configure(props);
  | 
  | 	logLevel = DEFAULT_LOGLEVEL;
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4175092#4175092

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4175092



More information about the jboss-user mailing list