logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apvrille, Axelle" <Apv...@europe.stortek.com>
Subject RE: log4j: ERROR No appenders could be found for category though I Ha ve specified an appender ?!
Date Thu, 14 Jun 2001 08:12:50 GMT
hello,
Just to let you know I had found my problem : configuration file was okay
but there was _one_ little log request in my sources before I had
initialized property configurator.

cat.debug("..."); <<<--------------- ERROR Message for that log !
PropertyConfigurator.configure(System.getProperty("log4j.conf.file"));

Sorry, and hope my error helps others...
Axelle.

> -----Message d'origine-----
> De : Apvrille, Axelle 
> Objet : log4j: ERROR No appenders could be found for category...
> 
> Hi,
> 
> I'm sorry I have to ask this question again, but I haven't 
> seen the exact
> answer to my problem or understood the answers... (?)
> 
> I've got the following complaints from log4j :
> log4j:ERROR No appenders could be found for category
> (worm.gui.TimestamperGUI).
> log4j:ERROR Please initialize the log4j system properly.
> 
> I've read from the "troubleshooting guide" this is because there's no
> appenders attached to my category or its ancestors. But I've 
> done that ! My
> configuration file is : 
> 
> log4j.rootCategory=DEBUG,MyFileAppender,MyConsoleAppender
> [..Definition of MyFileAppender and MyConsoleAppender...]
> log4j.category.worm=DEBUG,MyFileAppender, MyConsoleAppender
> 
> Isn't that last line attach worm category to my appenders ? 
> If worm is an
> ancestor of worm.gui.TimestampGUI, this should be okay ? 
> 
> -------
> Other maybe useful information :
> I'm passing my configuration file to the program through a 
> system property :
> java ... -Dlog4j.conf.file="log.properties" worm.gui.TimestampGUI
> 
> Then, in my application, I've got :
> package worm.gui;
> [...]
> import org.apache.log4j.Category;
> import org.apache.log4j.PropertyConfigurator;
> public class TimestampGUI {
> 	static Category cat =
> Category.getInstance(TimestamperGUI.class.getName());
> 	[...]
> 	public static void main(String args[]){
> 	  cat.debug("--> main()");
> 
> 	  try {
> 	    // setting up trace file
> 	
> PropertyConfigurator.configure(System.getProperty("log4j.conf.file"));
> 	    cat.info("Trace controller starts.");
> 	  }
> 	  catch(NullPointerException exp){
> 	    // no logging configuration file has been specified
> 	    // we disable logging
> 	    Category.getDefaultHierarchy().disableAll();
> 	  }
> 	}
> }

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message