You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/05/10 11:10:40 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/spi LoggingEventFieldResolver.java

ceki        2004/05/10 02:10:40

  Modified:    src/java/org/apache/log4j/spi LoggingEventFieldResolver.java
  Log:
  Removed support for the MDC fields as it has been merged into
  properties.
  
  Revision  Changes    Path
  1.7       +2 -10     logging-log4j/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java
  
  Index: LoggingEventFieldResolver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LoggingEventFieldResolver.java	9 May 2004 18:37:55 -0000	1.6
  +++ LoggingEventFieldResolver.java	10 May 2004 09:10:40 -0000	1.7
  @@ -46,8 +46,6 @@
    * EXCEPTION                 throwable string representation                   ThrowableInformation
    * TIMESTAMP                 timestamp                                         Long
    * THREAD                    thread                                            String
  - * MDC.keyName               entry in the MDC hashtable                        Object
  - *                           mapped to key [keyName]
    * PROP.keyName              entry in the Property hashtable                   String
    *                           mapped to the key [keyName]
   
  @@ -74,7 +72,6 @@
     public static final String EXCEPTION_FIELD = "EXCEPTION";
     public static final String TIMESTAMP_FIELD = "TIMESTAMP";
     public static final String THREAD_FIELD = "THREAD";
  -  public static final String MDC_FIELD = "MDC.";
     public static final String PROP_FIELD = "PROP.";
     public static final String EMPTY_STRING = "";
     private static final LoggingEventFieldResolver resolver =
  @@ -92,7 +89,6 @@
       keywordList.add(EXCEPTION_FIELD);
       keywordList.add(TIMESTAMP_FIELD);
       keywordList.add(THREAD_FIELD);
  -    keywordList.add(MDC_FIELD);
       keywordList.add(PROP_FIELD);
     }
     
  @@ -105,7 +101,7 @@
         
         while (tokenizer.hasMoreTokens()) {
             String token = tokenizer.nextToken();
  -          if (isField(token)  || (token.toUpperCase().startsWith(MDC_FIELD) || token.toUpperCase().startsWith(PROP_FIELD))) {
  +          if (isField(token) || token.toUpperCase().startsWith(PROP_FIELD)) {
                 result.append(getValue(token, event).toString());
             } else { 
                 result.append(token);
  @@ -120,7 +116,7 @@
   
     public boolean isField(String fieldName) {
       if (fieldName != null) {
  -        return (keywordList.contains(fieldName.toUpperCase()) || fieldName.toUpperCase().startsWith(MDC_FIELD) || fieldName.toUpperCase().startsWith(PROP_FIELD));
  +        return (keywordList.contains(fieldName.toUpperCase()) || fieldName.toUpperCase().startsWith(PROP_FIELD));
       }
       return false;
     }
  @@ -154,10 +150,6 @@
         return new Long(event.getTimeStamp());
       } else if (THREAD_FIELD.equals(upperField)) {
         return event.getThreadName();
  -    } else if (upperField.startsWith(MDC_FIELD)) {
  -      //note: need to use actual fieldname since case matters
  -      Object mdcValue = event.getMDC(fieldName.substring(4));
  -      return ((mdcValue == null) ? EMPTY_STRING : mdcValue.toString());
       } else if (upperField.startsWith(PROP_FIELD)) {
         //note: need to use actual fieldname since case matters
         String propValue = event.getProperty(fieldName.substring(5));
  
  
  

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