Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Category VS logger tags in jboss-log4j.xml

What should we use in jboss-log4j.xml in order to turn on/off traces for our product - "category" or "logger" tag?

By default JBoss uses "category" in jboss-log4j.xml.
But as far as I know "category" is deprecated and "logger" should be used instead.
Why JBoss uses deprecated "category" tag in a new product?

like image 278
Volodymyr Bezuglyy Avatar asked Mar 11 '10 14:03

Volodymyr Bezuglyy


People also ask

What is category in log4j XML?

The "Category" groups sets of logger components. This way the level of all the logger components for a particular category can be controlled with a single log4j XML configuration[Have a set of logger statements grouped into a category. Each category can have a log level.]

What is logger name in log4j XML?

In log4j a logger is associated with a package or sometimes with a particular class. Package/class of a logger is defined by the attribute "name". A logger logs messages in its package and also in all the child packages and their classes.

What is logger category?

Logger is a subclass of Category, i.e. 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. Internally, whenever log4j is asked to produce a Category object, it will instead produce a Logger object.

Does JBoss logging use log4j?

JBoss AS uses log4j as logging framework. This tutorial will show how to configure log4j service in your jBoss application server and also how to create a custom configuration which can be deployed along with your application. Log4j is a flexible open source project from Apache.


2 Answers

Habit, I suspect. I still to use category also. It behaves exactly the same as logger, there really is no difference.

like image 199
skaffman Avatar answered Sep 30 '22 06:09

skaffman


category in the log4j.xml (not limited to jboss-log4j.xml) is common practice and its not deprecated. What got deprecated is the Category Class as in usage of Category in code like,

Category category = Category.getInstance('something');

In log4j.xml, both category and logger can be used. Probably the newer code will have the logger in log4j.xml. Old way is category.

like image 25
arun k Avatar answered Sep 30 '22 06:09

arun k