Category VS logger tags in jboss-log4j.xml
Asked Answered
T

2

10

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?

Trudey answered 11/3, 2010 at 14:58 Comment(0)
D
8

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

Disuse answered 12/3, 2010 at 8:40 Comment(2)
Looking at the javadoc, the Category class is now deprecated in favor of Logger. In the configuration, I would expect both would be supported.Oran
it is bad habit to continue to use depreciated features.Afterburning
L
1

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.

Liselisetta answered 14/5, 2018 at 7:6 Comment(1)
Okay, but what about the difference between them? And also category seems to have level and priority as acceptable properties: what is the difference between those?Relique

© 2022 - 2024 — McMap. All rights reserved.