• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logger / ShutdownHook

 
Roy Pozarelli
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic