This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Logger / ShutdownHook  RSS feed

 
Ranch Hand
Posts: 590
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys. I was having a problem with logging in my shutdown hook and noticed a thread was previously posted in this forum with some advice. The thread is http://www.coderanch.com/t/502088/java/java/Logger-ShutdownHook

I am working on the OCMJD and I created a thread about my particular problem here.

The thread that was in this forum had some advice about how to solve the problem. There seem to be two solutions mentioned:

1) Add the handler back to the logger in the thread that you add using the addShutdownHook method.
2) Use an anonymous logger.

I have tried (1) and it works. But it doesn't seem like a good solution to me. There's no guarantee of when the LogManagers shutdown hook will be executed. So you could add the handler back to the logger in your shutdown thread, only for it to be removed by the LogManagers shutdown before your shutdown completes.

I have tried (2) and it doesn't work - some of my log statements do not get output. But I wonder am I understanding it correctly? I simply used java.util.logging.Logger.getAnonymousLogger() to get the anonymous logger. But maybe something else was meant?

Any ideas folks?
 
Sean Keane
Ranch Hand
Posts: 590
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any ideas guys?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!