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

Method getLogger of log4j

 
Swerrgy Smith
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can you tell me why we always need to use a class (or a name of a class) in the getLogger method?


Why don't we simply use a same name (for example "ABCDEFGH") for every .java file ?


Thank you very much.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swerrgy Smith wrote:Why don't we simply use a same name (for example "ABCDEFGH") for every .java file ?

You could, but when you are reading a log file, which do you think would be more useful to see as part of the messages - the name of the class that generated the log message or a string that has no relation to the java class ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic