This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
log4J and java.util.logging
final instance variable
edirect log to Eclipse console ?
Logging - entering method
Log4j will not write to log file.