At first I want to say hello to everybody... for last few months I have been only reader of this forum but now it's time to step out of shadows
My question is
SCJD related, although it seems to be more general. I am using 'java.util.logging' to trace flow of activities. Everything was fine but since I have started writing GUI part strange things happen.
In my app, first starts Runner class which parses command line etc. and then it creates MainFrame (inheriting from JFrame) and shows it; then runner finishes and activity remains in Swing parts (event queue threads keep app alive).
During development session (running MainFrame directly) it writes to log properly, but when it is run through Runner class, only Runner entries appear in log.
I spent few hours figuring problem out and eventually I discovered that when Runner finishes loggers stop working. I did simple
test - I have added some sleep in Runner after spawning MainFrame and... MainFrame did logging until Runner
thread was sleeping.
I did not further research but as for me the problem is within logging mechanism. Probably loggers store some data in context of thread which has loaded classes writing to logs - until this thread remains accessible logging by other threads (AWT event queue threads) works fine. But after loading thread's death logger are no more valid and swing/AWT's thread calls to loggers methods do fail
I did simple trick in Runner class logic - after spawning GUI it joins to AWT's event queue, so it does not die at all (until GUI is closed with JVM)
Now the questions are:
1) will this workaround be treated as too complex code, having impact on final score
2) does anybody know this 'java.util.logging' issue and other workarounds? I would like to keep using logging parts but covering whole running code
cheers,
andy.