-
The following is written in the official log4j API, which is sufficient to explain the difference between logger and category...
-
public class Category
-
Extends java. Lang. Object
-
Implements appenderattachable
This class has been deprecated and
Replaced byLogger
Subclass. It
Will be kept around to preserve backward compatibility until mid
2003.
Logger
Is a subclass of category, I. e. It extends
Category. In other words, a loggerIsA category. Thus,
All operations that can be performed med on a category can be
Synchronized med on a logger. Internally, whenever log4j is asked
Produce a category object, it will instead produce a logger
Object. log4j 1.2 willNeverProduce category objects
OnlyLogger
Instances. In order to preserve backward
Compatibility, methods that previously accepted category objects
Still continue to accept category objects.
For example, the following are all legal and will work
Expected.
// Deprecated form:
Category cat = Category.getInstance("foo.bar")
// Preferred form for retrieving loggers:
Logger logger = Logger.getLogger("foo.bar")
The first form is deprecated and shoshould be avoided.
There is absolutely no need for new client code to use or
Refer toCategory
Class.Whenever possible,
Please avoid referring to it or using it.
See the short manual for
Introduction on this class.
See the document entitled Preparing
For log4j 1.3 For a more detailed discussion.
-
Author:
-
Ceki gülc U, Anders Kristensen