File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Method getLogger of log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Method getLogger of log4j" Watch "Method getLogger of log4j" New topic

Method getLogger of log4j

Swerrgy Smith
Ranch Hand

Joined: Mar 26, 2010
Posts: 91
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

Joined: Aug 05, 2005
Posts: 3742
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 ?

I agree. Here's the link:
subject: Method getLogger of log4j
It's not a secret anymore!