Update of /cvsroot/genj/dev/src/core/genj/app
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8288/src/core/genj/app
Modified Files:
App.java
Log Message:
logging: fixed issue with shutdown messages not being logged because of LogManager's concurrent shutdown threads
Index: App.java
===================================================================
RCS file: /cvsroot/genj/dev/src/core/genj/app/App.java,v
retrieving revision 1.85
retrieving revision 1.86
diff -C2 -d -r1.85 -r1.86
*** App.java 6 Apr 2006 21:29:14 -0000 1.85
--- App.java 11 Apr 2006 04:33:52 -0000 1.86
***************
*** 40,43 ****
--- 40,44 ----
import java.util.logging.Handler;
import java.util.logging.Level;
+ import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
***************
*** 51,55 ****
public class App {
! /*package*/ static Logger LOG = Logger.getLogger("genj");
/**
--- 52,56 ----
public class App {
! /*package*/ static Logger LOG;
/**
***************
*** 61,64 ****
--- 62,69 ----
try {
+ // prepare our master log and own LogManager for GenJ
+ System.setProperty("java.util.logging.manager", "genj.app.App$PatchedLogManager");
+ LOG = Logger.getLogger("genj");
+
// prepare some basic logging for now
Formatter formatter = new LogFormatter();
***************
*** 81,85 ****
// initialize options first
OptionProvider.getAllOptions(registry);
!
// Setup File Logging and check environment
Handler handler = new FileHandler(new File(home, "genj.log").getAbsolutePath(), Options.getInstance().getMaxLogSizeKB()*1024, 1, true);
--- 86,90 ----
// initialize options first
OptionProvider.getAllOptions(registry);
!
// Setup File Logging and check environment
Handler handler = new FileHandler(new File(home, "genj.log").getAbsolutePath(), Options.getInstance().getMaxLogSizeKB()*1024, 1, true);
***************
*** 109,116 ****
}
! // Startup the UI
SwingUtilities.invokeLater(new Startup(registry, args));
-
- // Hook into Shutdown
Runtime.getRuntime().addShutdownHook(new Thread(new Shutdown(registry)));
--- 114,119 ----
}
! // run startup and hook up shutdown
SwingUtilities.invokeLater(new Startup(registry, args));
Runtime.getRuntime().addShutdownHook(new Thread(new Shutdown(registry)));
***************
*** 169,174 ****
// done
LOG.info("/Startup");
}
!
} //Startup
--- 172,178 ----
// done
LOG.info("/Startup");
+
}
!
} //Startup
***************
*** 197,201 ****
--- 201,211 ----
// done
LOG.info("/Shutdown");
+ // shutdown our patched log manager now
+ LogManager mgr = LogManager.getLogManager();
+ if (mgr instanceof PatchedLogManager)
+ ((PatchedLogManager)mgr).doReset();
+ // done
}
+
} //Shutdown
***************
*** 218,221 ****
--- 228,232 ----
}
public void close() throws SecurityException {
+ flush();
wrapped.close();
}
***************
*** 309,311 ****
--- 320,331 ----
}
+ public static class PatchedLogManager extends LogManager {
+ public void reset() throws SecurityException {
+ // noop
+ }
+ public void doReset() throws SecurityException {
+ super.reset();
+ }
+ }
+
} //App
|