Revision: 9511
Author: [email protected]
Date: Fri Jan  7 09:11:19 2011
Log: Make the logging framework provide a default uncaught exception
handler.  Note that this only effects production code. Dev mode
already installs a default uncaught exception handler.

http://gwt-code-reviews.appspot.com/1223802

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9511

Modified:
 /trunk/user/src/com/google/gwt/logging/client/LogConfiguration.java

=======================================
--- /trunk/user/src/com/google/gwt/logging/client/LogConfiguration.java Tue Aug 3 17:01:46 2010 +++ /trunk/user/src/com/google/gwt/logging/client/LogConfiguration.java Fri Jan 7 09:11:19 2011
@@ -18,6 +18,7 @@

 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
 import com.google.gwt.user.client.Window.Location;
 import com.google.gwt.user.client.ui.HasWidgets;

@@ -146,5 +147,16 @@

   public void onModuleLoad() {
     impl.configureClientSideLogging();
+
+    if (impl.loggingIsEnabled()) {
+      if (GWT.getUncaughtExceptionHandler() == null) {
+ final Logger log = Logger.getLogger(LogConfiguration.class.getName());
+        GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+          public void onUncaughtException(Throwable e) {
+            log.log(Level.SEVERE, e.getMessage(), e);
+          }
+        });
+      }
+    }
   }
 }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to