Level model of the JDK logging

Beside the problem that the default logger does not log milli seconds it doesn't log the thread that created the log entry. This makes it nearly unusable for concurrent programs. This issues can be solved by using your own formatter. This is a good idea to get rid of these localized timestamps, anyway.

But now I come to an issue which makes the JDK logging unusable for concurrent programs. You can set the log level for a logger but not for a thread. Assume you have two instances of the same thread and you know that one goes crazy after some time. You want to set a finer log level for the second thread. That is impossible! You have to set it for your class, producing lots of unwanted log entries.

The only solution I see is to use one logger per thread. That means you have to manage the configuration by your own and have a dependency of all your classes from a thread factory or something similar.

Is there any other solution available?

[972 byte] By [hauga] at [2007-10-2 22:12:10]
# 1
If you need a different logging level for two objects, two classes, or two threads you need to have two logger objects...
Peter__Lawreya at 2007-7-14 1:29:04 > top of Java-index,Core,Core APIs...
# 2

This means you have to pass a logger object to each class you develop. This is a significant influence in code and design and gives logging a weight it should not have. You not only need an additional attribute, you need an additional if statement to avoid NullPointerExceptions. If a logging framework requires that it is designed really bad.

hauga at 2007-7-14 1:29:04 > top of Java-index,Core,Core APIs...