You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2003/04/07 13:40:12 UTC

cvs commit: avalon-logkit/src/java/org/apache/log Hierarchy.java

donaldp     2003/04/07 04:40:12

  Modified:    src/java/org/apache/log Hierarchy.java
  Log:
  Add brackets and made default formatter string public
  
  Revision  Changes    Path
  1.33      +18 -11    avalon-logkit/src/java/org/apache/log/Hierarchy.java
  
  Index: Hierarchy.java
  ===================================================================
  RCS file: /home/cvs/avalon-logkit/src/java/org/apache/log/Hierarchy.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Hierarchy.java	4 Mar 2003 14:58:58 -0000	1.32
  +++ Hierarchy.java	7 Apr 2003 11:40:11 -0000	1.33
  @@ -69,12 +69,12 @@
   public class Hierarchy
   {
       ///Format of default formatter
  -    private static final String FORMAT =
  -        "%7.7{priority} %23.23{time:yyyy-MM-dd' 'HH:mm:ss.SSS} [%8.8{category}] (%{context}): "
  -        + "%{message}\n%{throwable}";
  +    public static final String DEFAULT_FORMAT =
  +        "%7.7{priority} %23.23{time:yyyy-MM-dd' 'HH:mm:ss.SSS} " +
  +        "[%8.8{category}] (%{context}): %{message}\n%{throwable}";
   
       ///The instance of default hierarchy
  -    private static final Hierarchy HIERARCHY = new Hierarchy();
  +    private static final Hierarchy c_hierarchy = new Hierarchy();
   
       ///Error Handler associated with hierarchy
       private ErrorHandler m_errorHandler;
  @@ -98,7 +98,7 @@
        */
       public static Hierarchy getDefaultHierarchy()
       {
  -        return HIERARCHY;
  +        return c_hierarchy;
       }
   
       /**
  @@ -113,7 +113,7 @@
                                      "", null, null );
   
           //Setup default output target to print to console
  -        final PatternFormatter formatter = new PatternFormatter( FORMAT );
  +        final PatternFormatter formatter = new PatternFormatter( DEFAULT_FORMAT );
           final StreamTarget target = new StreamTarget( System.out, formatter );
   
           setDefaultLogTarget( target );
  @@ -205,15 +205,19 @@
        */
       public synchronized void addLoggerListener( final LoggerListener loggerListener )
       {
  -        if ( null == loggerListener ) throw new NullPointerException( "loggerListener" );
  +        if( null == loggerListener )
  +        {
  +            throw new NullPointerException( "loggerListener" );
  +        }
   
  -        if ( null == m_loggerListener )
  +        if( null == m_loggerListener )
           {
               m_loggerListener = loggerListener;
           }
           else
           {
  -            throw new UnsupportedOperationException( "LoggerListener already set on a unicast event notifier" );
  +            final String message = "LoggerListener already set on a unicast event notifier";
  +            throw new UnsupportedOperationException( message );
           }
       }
   
  @@ -225,9 +229,12 @@
        */
       public synchronized void removeLoggerListener( final LoggerListener loggerListener )
       {
  -        if ( null == loggerListener ) throw new NullPointerException( "loggerListener" );
  +        if( null == loggerListener )
  +        {
  +            throw new NullPointerException( "loggerListener" );
  +        }
   
  -        if ( null != m_loggerListener && m_loggerListener == loggerListener );
  +        if( null != m_loggerListener && m_loggerListener == loggerListener ) ;
           {
               m_loggerListener = null;
           }
  
  
  

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