craigmcc    2004/02/28 15:00:57

  Modified:    logging/src/java/org/apache/commons/logging/impl
                        SimpleLog.java
  Log:
  Eliminate spurious second "-" character when showShortLogname=true.
  
  PR:  Bugzilla #25940
  Submitted by: Dennis Lundberg <dennis.lundberg at mdh.se>
  
  Revision  Changes    Path
  1.17      +9 -9      
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SimpleLog.java    28 Feb 2004 21:46:45 -0000      1.16
  +++ SimpleLog.java    28 Feb 2004 23:00:57 -0000      1.17
  @@ -152,7 +152,6 @@
           showLogName = getBooleanProperty( systemPrefix + "showlogname", 
showLogName);
           showShortName = getBooleanProperty( systemPrefix + "showShortLogname", 
showShortName);
           showDateTime = getBooleanProperty( systemPrefix + "showdatetime", 
showDateTime);
  -        showLogName = getBooleanProperty( systemPrefix + "showlogname", 
showLogName);
   
           if(showDateTime) {
               dateFormatter = new SimpleDateFormat(
  @@ -168,8 +167,8 @@
       protected String logName = null;
       /** The current log level */
       protected int currentLogLevel;
  -
  -    private String prefix=null;
  +    /** The short name of this simple log instance */
  +    private String shortLogName = null;
   
       
       // ------------------------------------------------------------ Constructor
  @@ -275,12 +274,13 @@
   
           // Append the name of the log instance if so configured
        if( showShortName) {
  -            if( prefix==null ) {
  -                // cut all but the last component of the name for both styles
  -                prefix = logName.substring( logName.lastIndexOf(".") +1) + " - ";
  -                prefix = prefix.substring( prefix.lastIndexOf("/") +1) + "-";
  +            if( shortLogName==null ) {
  +                // Cut all but the last component of the name for both styles
  +                shortLogName = logName.substring(logName.lastIndexOf(".") + 1);
  +                shortLogName =
  +                    shortLogName.substring(shortLogName.lastIndexOf("/") + 1);
               }
  -            buf.append( prefix );
  +            buf.append(String.valueOf(shortLogName)).append(" - ");
           } else if(showLogName) {
               buf.append(String.valueOf(logName)).append(" - ");
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to