File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Logger / ShutdownHook Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Logger / ShutdownHook" Watch "Logger / ShutdownHook" New topic
Author

Logger / ShutdownHook

Roy Pozarelli
Ranch Hand

Joined: Oct 17, 2009
Posts: 42
I have a "close" method that was added as a ShutdownHook on its own thread. I also have a Logger for debugging purposes and as a way to document errors in the close operation. I'm seeing behavior that I don't understand. I've set up a FileHandler andSimpleFormatter for the logger (log) and set the Level.FINEST, however, when I enter the close operation on a "normal" exit of the program, the response from log.getLevel() is null. Am I now seeing the "parents" log level?
Also, if I explicitly set the log.level(Level.FINEST) in the close method, I'm still not seeing log.exiting("...") entries (this is in a finally block) as well as the log.entering("...") or exiting for the methods that this close method calls in my error.log file that it has been mapped to.
All other methods in the class have entering/exiting logging and it all seems to work correctly.


OCP Java SE 6 Programmer,
OCM Java SE 6 Developer
OCE Web Components (OCEWD)
OCE JPA 6 (OCEJPAD)
OCE EJB 6 (OCEBCD)
OCE Web Services (OCEWSD)
MySQL Certified Administrator & Developer,
OMG Certified UML Prof. Fund., Int., Adv.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logger / ShutdownHook