You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/02/26 08:32:32 UTC

cvs commit: jakarta-avalon/proposal/4.0/src/java/org/apache/log/format AvalonLogFormatter.java

donaldp     01/02/25 23:32:32

  Added:       proposal/4.0/src/java/org/apache/log/format
                        AvalonLogFormatter.java
  Log:
  Readded LogFormatter
  
  Revision  Changes    Path
  1.1                  jakarta-avalon/proposal/4.0/src/java/org/apache/log/format/AvalonLogFormatter.java
  
  Index: AvalonLogFormatter.java
  ===================================================================
  /* 
   * Copyright (C) The Apache Software Foundation. All rights reserved. 
   * 
   * This software is published under the terms of the Apache Software License 
   * version 1.1, a copy of which has been included with this distribution in 
   * the LICENSE file. 
   */ 
  package org.apache.log.format;
  
  import java.util.Date;
  import org.apache.aut.ExceptionUtil;
  import org.apache.log.format.PatternFormatter;
  
  /**
   * Specialized formatter that knows about CascadingThrowables.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class AvalonLogFormatter 
      extends PatternFormatter
  {
      protected String getStackTrace( final Throwable throwable, final String format )
      {
          if( null == throwable ) return "";
          return ExceptionUtil.printStackTrace( throwable, 8, true );
      }
  
      /**
       * 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();
      }
  }