• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is anyone using the logging API

 
Zkr Ryz
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've search in the internet for a simple example but I haven't found anything.
I'm not very sure how should a logger be acquired, because everywhere I see there's declarations like this.
Logger log = Logger.getLogger("com.apps.MainApp");
I guess this reads a MainApp.properties in the com/apps/ dir but I'm not sure.
Could someone give the simplest logger.log("Hello world"); example?
Any help will do.
Thanks in advance.
 
El Durango
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check out the following links.
http://www.esus.com/docs/GetIndexPage.jsp?uid=265 (need to register to view code)
There is a couple logging examples in this one:
http://www.idevelopment.info/data/Programming/java/PROGRAMMING_Java_Programming.shtml
hope that helped.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Zkr Ryz:

Logger log = Logger.getLogger("com.apps.MainApp");
I guess this reads a MainApp.properties in the com/apps/ dir but I'm not sure.

No, that gets or creates a log with a named context. That's so you can track or limit output by subsystem, hence the dot-seperated syntax that maps to a package. The simplest example ever:

There is a lot that can be done with the logging API. Check out the overview.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JavaRanch Journal - Logging in J2SE 1.4
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!