All of the logging is controlled by a global object called LogManager. This being a static variable (is it?), there is one LogManager for each webapp. So each LogManager can have its own configuration.
Using its readconfiguration method it can read its own configuration separate from other log managers.
How about the containers log manager such as tomcat? I am hoping it has its own. I am hoping when a webapp asks for a log manager what you receive is not from the tomcats logmanager
Satya - Thursday, March 03, 2005 6:44:16 PM
What is the difference between Logger.getLogger() and LogManager.getLogger()
LogManager's getLogger() will return a logger only if it exists. I think the Logger.getLogger() will create a new one if it doesn't exist.
Initially if you are seeing a null Logger, just check which call you made
Satya - Friday, March 04, 2005 9:03:13 AM
Is there anyway to load the handlers automatically from a properties file?
Consider instantiating a logger
Logger testLogger = Logger.getLogger("test");
At that time the test logger does not have any handlers attached to it. You can attach them programmatically.
But can you attach them via a properties load file? Example:
test.handlers=handler1,handler2 etc.
I have seen some home grown solutions do this. Is this something you have to write on your own or such a facility exists in the jdk 1.4 logging?
Satya - Friday, March 04, 2005 9:16:42 AM
Another example properties file
.level = ALL
test.level=ALL
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
#This doesn't seem to work with out
#extra help from the source code.
test.handlers=java.util.logging.ConsoleHandler
Satya - Friday, March 04, 2005 9:19:19 AM
What is the meaning of the above properties file?
There is a logger called "test". Its level is set to log all messages of any severity. This logger uses a handler called console handler. Based on previous notes you may have to register this yourself programmatically.
Once registered, you can set the formatter and the level for that console handler.
Satya - Friday, March 04, 2005 9:22:56 AM
It seems to be important to read the properties files before getting the loggers