• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Get all categories defined in log4j.xml

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry.. typo..

getNextElement() ---> nextElement()
 
James Basller
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic