You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/08/07 17:07:02 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/util/log CocoonLogFormatter.java ExtensiblePatternFormatter.java

cziegeler    01/08/07 08:07:02

  Modified:    src/org/apache/cocoon/util/log CocoonLogFormatter.java
                        ExtensiblePatternFormatter.java
  Log:
  Synced logger with latest logkit and changed getTime output format to AvalonLogFormatter style
  
  Revision  Changes    Path
  1.3       +14 -1     xml-cocoon2/src/org/apache/cocoon/util/log/CocoonLogFormatter.java
  
  Index: CocoonLogFormatter.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/log/CocoonLogFormatter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CocoonLogFormatter.java	2001/07/24 12:57:41	1.2
  +++ CocoonLogFormatter.java	2001/08/07 15:07:02	1.3
  @@ -8,6 +8,7 @@
   
   package org.apache.cocoon.util.log;
   
  +import java.util.Date;
   import java.util.Map;
   
   import org.apache.avalon.framework.CascadingThrowable;
  @@ -32,7 +33,7 @@
    * </ul>
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/07/24 12:57:41 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/08/07 15:07:02 $
    */
   
   public class CocoonLogFormatter extends ExtensiblePatternFormatter
  @@ -195,6 +196,18 @@
           }
   
           return sb.toString();
  +    }
  +
  +    /**
  +     * Utility method to format time.
  +     *
  +     * @param time the time
  +     * @param format ancilliary format parameter - allowed to be null
  +     * @return the formatted string
  +     */
  +    protected String getTime( final long time, final String format )
  +    {
  +        return new Date().toString();
       }
   
   }
  
  
  
  1.3       +13 -8     xml-cocoon2/src/org/apache/cocoon/util/log/ExtensiblePatternFormatter.java
  
  Index: ExtensiblePatternFormatter.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/log/ExtensiblePatternFormatter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExtensiblePatternFormatter.java	2001/07/24 12:57:41	1.2
  +++ ExtensiblePatternFormatter.java	2001/08/07 15:07:02	1.3
  @@ -23,12 +23,12 @@
    * The +|- indicates left or right justify.
    * The #.# indicates the minimum and maximum size of output.
    * 'field' indicates which field is to be output and must be one of
  - *  proeprties of LogEvent
  + *  properties of LogEvent
    * 'subformat' indicates a particular subformat and is currently unused.
    *
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/07/24 12:57:41 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/08/07 15:07:02 $
    */
   public class ExtensiblePatternFormatter
       implements Formatter
  @@ -254,8 +254,15 @@
           }
           else if( maxSize > 0 && maxSize < size )
           {
  +            if( rightJustify )
  +            {
  +                sb.append( output.substring( size - maxSize ) );
  +            }
  +            else
  +        {
               sb.append( output.substring( 0, maxSize ) );
           }
  +        }
           else
           {
               sb.append( output );
  @@ -311,8 +318,6 @@
       {
           final StringBuffer sb = new StringBuffer();
   
  -        String str = null;
  -
           for( int i = 0; i < m_formatSpecification.length; i++ )
           {
               final PatternRun run =  m_formatSpecification[ i ];
  @@ -324,11 +329,11 @@
               }
               else
               {
  -                str = formatPatternRun( event, run );
  +                final String data = formatPatternRun( event, run );
                   
  -                if (str != null)
  +                if( null != data )
                   {
  -                    append( sb, run.m_minSize, run.m_maxSize, run.m_rightJustify, str );
  +                    append( sb, run.m_minSize, run.m_maxSize, run.m_rightJustify, data );
                   }
               }
           }
  @@ -560,4 +565,4 @@
       {
           parse( format );
       }
  -}
  \ No newline at end of file
  +}
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org