log4j笔记之Category

org.apache.log4j.Category

This class has been deprecated and replaced by the Logger subclass. It will be kept around to preserve backward compatibility until mid 2003.

这个类已经被废弃并且被Logger的子类代替。它将将保留为了保持向后兼容性,直到2003年中期。

Logger is a subclass of Category, it extends Category. In other words, a logger is a category. Thus, all operations that can be performed on a category can be performed on a logger. Whenever log4j is asked to produce a Category object, it will instead produce a Logger object. However, methods that previously accepted category objects still continue to accept category objects.

Logger是Category的子类,它继承了Category。换句话说,logger就是category。因此,所有的操作(能使用category完成的)都能用logger完成。无论什么时候,当需要使用log4j来创建一个Category对象,都可以产生一个Logger对象来替换。

For example, the following are all legal and will work as 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 should be avoided.

第一种形式已经废弃,应该避免使用

There is absolutely no need for new client code to use or refer to the Category class. Whenever possible, please avoid referring to it or using it.

绝对没必要在新的代码中使用或者参照Category class。无论什么时候,如果可能的话,请避免使用或则参照Category Class

See the short manual for an introduction on this class. 看简短手册对Category Class的介绍

猜你喜欢

转载自weigang-gao.iteye.com/blog/2149425