This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Get all categories defined in log4j.xml

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to get all the properties from log4j.xml

So, can anyone please help me out to solve this?

Thanks in advance!!!

Thanks
James
 
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use getAllAppenders() to read information related to Appenders.

And getCurrentCategories( ) of Category class to get the categories defined.

Note that getCurrentCategories( ) is deprecated..

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#getCurrentCategories%28%29
 
James Basller
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Chinna Eranna wrote:you can use getAllAppenders() to read information related to Appenders.

And getCurrentCategories( ) of Category class to get the categories defined.

Note that getCurrentCategories( ) is deprecated..

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#getCurrentCategories%28%29




Hi

Thanks for reply!!!

Here what I am doing is like



This is what I am doing to get categories from $JBOSS_HOME/server/default/conf/log4j.xml file.

As getCurrentCategories() method is deprecated I have used above code but it gives me object of org.apache.log4j.Logger not the category class objects

So, can anyone please do more focus into this?

Thanks
James
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont see.. calling "getNextElement( )" on the enumeration object.
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry.. typo..

getNextElement() ---> nextElement()
 
James Basller
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Chinna Eranna wrote:sorry.. typo..

getNextElement() ---> nextElement()




yes...

I have solved my mistake.

As getCurrentCategories() method is deprecated I have used above code but it gives me object of org.apache.log4j.Logger not the category class objects

so basically why I need this to get Enumeration of multiple categories and get priority of each and every category...

Can you please give me answer?

Thanks
James
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logger is a subclass of Category.

You can get all information from Logger, that you use to get from Category
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!