You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2003/05/17 21:02:44 UTC

cvs commit: avalon-excalibur/thread/src/java/org/apache/avalon/excalibur/thread/impl SimpleWorkerThread.java

leif        2003/05/17 12:02:44

  Modified:    thread/src/java/org/apache/avalon/excalibur/thread/impl
                        SimpleWorkerThread.java
  Log:
  Update the debug log messages so they all include both the name of the logger
  as well as the current thread name.  A big help when trying to figure out what is
  happening in the multi threaded chaos that is a thread pool.  Nice when they work
  but when things are going wrong, debugging can have unexpected consequences
  on your sanity.
  
  Revision  Changes    Path
  1.9       +17 -4     avalon-excalibur/thread/src/java/org/apache/avalon/excalibur/thread/impl/SimpleWorkerThread.java
  
  Index: SimpleWorkerThread.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/thread/src/java/org/apache/avalon/excalibur/thread/impl/SimpleWorkerThread.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SimpleWorkerThread.java	17 May 2003 18:30:19 -0000	1.8
  +++ SimpleWorkerThread.java	17 May 2003 19:02:44 -0000	1.9
  @@ -91,6 +91,10 @@
       {
           m_logger = logger;
           m_detailLogger = logger.getChildLogger( "detail" );
  +        
  +        // Log a created message here rather as we can't in the constructor
  +        //  due to the lack of a logger.
  +        debug( "created." );
       }
   
       /**
  @@ -103,7 +107,13 @@
       {
           if ( m_logger.isDebugEnabled() )
           {
  -            m_logger.debug( getName() + ": " + message );
  +            // As we are dealing with threads where more than one thread is
  +            //  always involved, log both the name of the thread that triggered
  +            //  event along with the name of the worker involved.  This
  +            //  increases the likely hood of walking away sane after a
  +            //  debugging session.
  +            m_logger.debug( "\"" + getName() + "\" "
  +                + "(in " + Thread.currentThread().getName() + ") : " + message );
           }
       }
   
  @@ -118,7 +128,8 @@
       {
           if ( m_logger.isDebugEnabled() )
           {
  -            m_logger.debug( getName() + ": " + message, throwable );
  +            m_logger.debug( "\"" + getName() + "\" "
  +                + "(in " + Thread.currentThread().getName() + ") : " + message, throwable );
           }
       }
   
  @@ -133,7 +144,8 @@
       {
           if ( m_detailLogger.isDebugEnabled() )
           {
  -            m_detailLogger.debug( getName() + ": " + message );
  +            m_detailLogger.debug( "\"" + getName() + "\" "
  +                + "(in " + Thread.currentThread().getName() + ") : " + message );
           }
       }
   
  @@ -149,7 +161,8 @@
       {
           if ( m_detailLogger.isDebugEnabled() )
           {
  -            m_detailLogger.debug( getName() + ": " + message, throwable );
  +            m_detailLogger.debug( "\"" + getName() + "\" "
  +                + "(in " + Thread.currentThread().getName() + ") : " + message, throwable );
           }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org