commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging/impl SimpleLog.java
Date Mon, 01 Mar 2004 02:12:49 GMT
craigmcc    2004/02/29 18:12:49

  Modified:    logging/src/java/org/apache/commons/logging/impl
                        SimpleLog.java
  Log:
  Factor the actual writing out of log() into a new write() method so that
  subclasses can easily specialize this function, without having to specialize
  the creation of the message to be written.
  
  PR:  Bugzilla #27135
  Submitted by:  Aaron Hamid <arh14 at cornell.edu>
  
  Revision  Changes    Path
  1.18      +24 -4     jakarta-commons/logging/src/java/org/apache/commons/logging/impl/SimpleLog.java
  
  Index: SimpleLog.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/SimpleLog.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SimpleLog.java	28 Feb 2004 23:00:57 -0000	1.17
  +++ SimpleLog.java	1 Mar 2004 02:12:48 -0000	1.18
  @@ -250,7 +250,11 @@
       /**
        * <p> Do the actual logging.
        * This method assembles the message
  -     * and then prints to <code>System.err</code>.</p>
  +     * and then calls <code>write()</code> to cause it to be written.</p>
  +     *
  +     * @param type One of the LOG_LEVE_XXX constants defining the log level
  +     * @param message The message itself (typically a String)
  +     * @param t The exception whose stack trace should be logged
        */
       protected void log(int type, Object message, Throwable t) {
           // Use a string buffer for better performance
  @@ -301,8 +305,24 @@
               buf.append(sw.toString());
           }
   
  -        // Print to System.err
  -        System.err.println(buf.toString());
  +        // Print to the appropriate destination
  +        write(buf);
  +
  +    }
  +
  +
  +    /**
  +     * <p>Write the content of the message accumulated in the specified
  +     * <code>StringBuffer</code> to the appropriate output destination.  The
  +     * default implementation writes to <code>System.err</code>.</p>
  +     *
  +     * @param buffer A <code>StringBuffer</code> containing the accumulated
  +     *  text to be logged
  +     */
  +    protected void write(StringBuffer buffer) {
  +
  +        System.err.println(buffer.toString());
  +
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message