Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log.getLogger()

 
Matt Zollinhofer
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to be good about using logging the best way as I start a new web app. I remember someone telling me that I should use LogFactory.getLogger(String) rather than LogFactory.getLogger(Class), but I don't remember why or if I believed them :-).

Can anyone elaborate on the difference (if any) between the two methods. It seems to me that using the String might be a little faster because the LogFactory wouldn't have to waste time translating the Class into a String. It seems safer to me to use the Class in case packages change (which I realize isn't all that common). Those are the only two differences I can think of. If I'm right and using the String is faster, then I'd probably do that but I'd be interested to know how much of an impact it really has.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic