Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 97252 invoked by uid 500); 7 Aug 2001 15:08:45 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 97236 invoked by uid 500); 7 Aug 2001 15:08:45 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Date: 7 Aug 2001 15:07:02 -0000 Message-ID: <20010807150702.43955.qmail@icarus.apache.org> From: cziegeler@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/org/apache/cocoon/util/log CocoonLogFormatter.java ExtensiblePatternFormatter.java X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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 @@ * * * @author Sylvain Wallez - * @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 Peter Donald * @author Sylvain Wallez - * @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