logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam L. Menkes" <amen...@ecwise.com>
Subject FW: Log4J questions
Date Tue, 26 Jun 2001 21:06:49 GMT
Though Sun's JDK 1.4 logging is bad compared to what Log4J appears
capable of doing, there are some things that I saw that I liked, but
could not figure out how to do in Log4J.

Specifically, the logging of class/method names without having to
provide them. For example, in JDK 1.4 beta, you can do the following:

logger.config("Some message");

And it will provide the following info (I added the color for emphasis):

Jun 26, 2001 12:52:11 PM LogTest <init>
INFO: Some message

As you can see, it picks up the class name and method (in this case, the
constructor, represented by "<init>").

Note that .config is only used for example, as normally you would use
logger.entering() / logger.exiting() (see bug ID #4474150).

This is very useful, since class names may change (though infrequent)
and method names change (more frequent), plus, it allows for copy/paste
of standard calls to every method:




Also, if a class inherits from another class, it would be nice if it
reported the actual class ("entering Apple" instead of the superclass
"entering Fruit") without having to account for the differences.

Similarly, it would be nice if Category.getInstance() could add a no-arg
constructor which would determine the class without having to add
"MyClass.class" or "MyClass.class.getName()". I would make it
additional, and not deprecate the existing, as you may want to setup
global (public static) Category in a separate class. 


On another note, just FYI, there are some typos in your documentation.
In examples (and examples/doc-files), the *.lcf files spell
"documentation" incorrectly (documenation).


View raw message