Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

getAllAppenders returns empty Enumeration

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We have a appender setup in the log4j.xml as follows:



We have used this appender for the package "com.dbdata.core" as follows:



In our code we use the logger as follows:



The logging works fine. The logs are written to the correct files. But issue that we are seeing is that the method getAllAppenders() on the Logger returns an empty Enumeration in this class.
We tried a few things one of them being instantiation of the logger. We changed it to:


Then when we invoked the getAllAppenders() method on the logger we got a Enumeration containing the reference to our appender.

My question is, how can i get references to the appender by instantiating the logger as follows:

I believe the getAllAppenders() should return the reference to the appender, even in this case, since the logger is using the CORE_LOG appender(verified by checking the logs in the core.log file).




}
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic