Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Obtaining access to Logger using a different Mechanism

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, we are using a Log4j to implement Logging Mecanism in our Application .

we are not using

to obtain access to Log4j



Instead we used an SomeLogger class taht will return the instance of the Logger as shown below .



A code snippet of this SomeLogger is shown below :



What is the advantage we get if we use this way ??

Thanks in advance .
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see a reason why that SomeLogger class is required. Does it have any javadoc or anything else which explains why it's there?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jai for the response .

This might be useful to provide me a better response , this is the only code
// This code is getting the log4j.properties path



 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't that class pointless? Why have you chosen to not use the out the box mechanisms for loading your log4j configuration?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, unless there's other magic going on, or you really, really need to have your logging properties specified as a string constant, there are better, easier, more conventional ways of doing this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic