logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r569188 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: LogPanel.java LogUI.java
Date Thu, 23 Aug 2007 23:38:43 GMT
Author: sdeboy
Date: Thu Aug 23 16:38:42 2007
New Revision: 569188

URL: http://svn.apache.org/viewvc?rev=569188&view=rev
Log:
Register an uncaughtexceptionhandler in order to get a stack trace (for example, OOME)
If we call readobject and get an ioexception, delete the file

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=569188&r1=569187&r2=569188&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Thu Aug 23
16:38:42 2007
@@ -2295,6 +2295,8 @@
       } catch (EOFException eof) { //end of file - ignore..
       }catch (IOException ioe) {
         ioe.printStackTrace();
+        //unable to load file - delete it
+        f.delete();
       } catch (ClassNotFoundException cnfe) {
         cnfe.printStackTrace();
       } finally {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=569188&r1=569187&r2=569188&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Thu Aug 23 16:38:42
2007
@@ -37,6 +37,7 @@
 import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.io.IOException;
+import java.lang.Thread.UncaughtExceptionHandler;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -352,6 +353,12 @@
     Logger.getLogger("org.apache.log4j").removeAllAppenders();
     Logger.getLogger("org.apache.log4j").addAppender(rewriteAppender);
     Logger.getLogger("org.apache.log4j").setAdditivity(false);
+    
+    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+		public void uncaughtException(Thread t, Throwable e) {
+			logger.error("Uncaught exception in thread " + t, e);
+		}
+    });
 
     String config = model.getConfigurationURL();
     if(config!=null && (!(config.trim().equals("")))) {



Mime
View raw message