jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r762943 - in /incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH: ChangeLog src/com/ecyrd/jspwiki/Release.java src/com/ecyrd/jspwiki/util/WatchDog.java
Date Wed, 08 Apr 2009 04:12:14 GMT
Author: jalkanen
Date: Tue Apr  7 20:32:32 2009
New Revision: 762943

URL: http://svn.apache.org/viewvc?rev=762943&view=rev
Log:
        * Improved WatchDog thread dump code so that it does not generate two 
        log events for every hung thread.  Instead, all hung thread events are now
        generated as a single log event.  Also, thread dumps are now sent
        at DEBUG level, since they are not errors per se.

Modified:
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog?rev=762943&r1=762942&r2=762943&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/ChangeLog Tue Apr  7 20:32:32 2009
@@ -1,3 +1,12 @@
+2008-04-04  Janne Jalkanen <jalkanen@apache.org>
+
+        * 2.8.3-svn-4
+        
+        * Improved WatchDog thread dump code so that it does not generate two 
+        log events for every hung thread.  Instead, all hung thread events are now
+        generated as a single log event.  Also, thread dumps are now sent
+        at DEBUG level, since they are not errors per se.
+        
 2009-04-07 Andrew Jaquith <ajaquith AT apache DOT org>
 
         * 2.8.3-svn-3

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java?rev=762943&r1=762942&r2=762943&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/Release.java Tue Apr
 7 20:32:32 2009
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "2";
+    public static final String     BUILD         = "4";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java?rev=762943&r1=762942&r2=762943&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java
Tue Apr  7 20:32:32 2009
@@ -303,9 +303,10 @@
                 if( now > st.getExpiryTime() )
                 {
                     log.info("Watchable '" + m_watchable.getName() + "' exceeded timeout
in state '" + st.getState() + "' by "
-                             + (now - st.getExpiryTime()) / 1000 + " seconds");
+                             + (now - st.getExpiryTime()) / 1000 + " seconds"+(log.isDebugEnabled()
? "" : "Enable DEBUG-level logging to see stack traces."));
 
                     dumpStackTraceForWatchable();
+                    
                     m_watchable.timeoutExceeded(st.getState());
                 }
             }
@@ -316,11 +317,18 @@
         }
     }
 
+    /**
+     *  Dumps the stack traces as DEBUG level events.
+     */
     private void dumpStackTraceForWatchable()
     {
+        if( !log.isDebugEnabled() ) return;
+        
         Map<Thread, StackTraceElement[]> stackTraces = Thread.getAllStackTraces();
         Set<Thread> threads = stackTraces.keySet();
         Iterator<Thread> threadIterator = threads.iterator();
+        StringBuilder stacktrace = new StringBuilder();
+
         while ( threadIterator.hasNext() )
         {
             Thread t = threadIterator.next();
@@ -328,21 +336,21 @@
             {
                 if( t.getName().equals( m_watchable.getName() ) )
                 {
-                    log.error( "dumping stacktrace for too long running thread : " + t );
+                    stacktrace.append( "dumping stacktrace for too long running thread :
" + t );
                 }
                 else
                 {
-                    log.error( "dumping stacktrace for other running thread : " + t );
+                    stacktrace.append( "dumping stacktrace for other running thread : " +
t );
                 }
                 StackTraceElement[] ste = stackTraces.get( t );
-                StringBuilder stacktrace = new StringBuilder( "stacktrace follows" );
                 for( int i = 0; i < ste.length; i++ )
                 {
                     stacktrace.append( "\n" + ste[i] );
                 }
-                log.error( stacktrace.toString() );
             }
         }
+        
+        log.debug( stacktrace.toString() );
     }
 
     /**



Mime
View raw message