This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes  private static Logger logger = Logger.getRootLogger(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " private static Logger logger = Logger.getRootLogger();" Watch " private static Logger logger = Logger.getRootLogger();" New topic
Author

private static Logger logger = Logger.getRootLogger();

Sowm Herur
Ranch Hand

Joined: Jul 07, 2008
Posts: 32

The following declaration:

private static Logger logger = Logger.getRootLogger();
In this declaration what is a Logger and logger?

and how come they are able to access the method getRootLogger() without creating the object?

Please clarify..
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

Logger ir a class. logger is instance of Logger.

Logger class may contain static methods that will be accessable without creating instance of class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: private static Logger logger = Logger.getRootLogger();
 
Similar Threads
final instance variable
log4J and java.util.logging
Log4j will not write to log file.
Logging - entering method
edirect log to Eclipse console ?