Java Logging API Strange behaviour
Similar to the problem of :
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=746125
I have the following problem:
I have the following class
package my.test;
publicclass TestLogging{
static Logger log=Logger.getLogger( TestLogging.class.getPackage().getName());
publicstatic loadAndLog(){
log.info("Loading logging configuration");
try{
// load logging configuration
InputStream logConfig=getResourceAsStream("/WEB-INF/logging.conf");
if(logConfig==null){
log.info("Log config file could not be found");
}else{
LogManager.getLogManager().readConfiguration(logConfig);
log.info("Logging configuration loaded");
}
}catch(IOException ioe){
ioe.printStackTrace();
log.warning("Logging configuration loading failed");
System.out.println("Logging loaded failed");
}
}
}
The file logging.conf contains the following settings
# defaults
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
.level=FINE
# Handlers settings
java.util.logging.ConsoleHandler.level=FINE
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level=FINE
# custom loggers settings
my.test.level=FINE
Now running the static method gives me this output:
INFO: Loading logging configuration
But i expect this output:
INFO: Loading logging configuration
INFO: Logging configuration loaded
What am i doing wrong?
I have read the Java Logging API OVerview and Javadoc,
i don't knwo what is going wrong.
My real program has a lot more loggers and the configration
file is loaded in the begin of the program.. But then none of the loggers
output anything! But all levels are set on FINE.
WTF

