User: user57  
  Date: 02/02/16 23:55:10

  Modified:    src/main/org/jboss/logging TracePriority.java
  Log:
   o allows xml file format to be used with trace priority
  
  Revision  Changes    Path
  1.3       +35 -19    jboss/src/main/org/jboss/logging/TracePriority.java
  
  Index: TracePriority.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/TracePriority.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TracePriority.java        4 Jan 2002 00:14:18 -0000       1.2
  +++ TracePriority.java        17 Feb 2002 07:55:10 -0000      1.3
  @@ -1,9 +1,10 @@
   /*
  -* JBoss, the OpenSource J2EE webOS
  -*
  -* Distributable under LGPL license.
  -* See terms of license at gnu.org.
  -*/
  + * JBoss, the OpenSource J2EE webOS
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
  +
   package org.jboss.logging;
   
   import org.apache.log4j.Priority;
  @@ -18,17 +19,25 @@
    * @see org.apache.log4j.Priority
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class TracePriority 
      extends Priority
   {
      /** The integer representation of the priority, (Priority.DEBUG_INT - 100) */
      public static final int TRACE_INT = Priority.DEBUG_INT - 100;
  +
  +   /** The string name of the trace priority. */
  +   public static String TRACE_STR = "TRACE";
      
      /** The TRACE priority object singleton */
  -   public static final TracePriority TRACE = new TracePriority(TRACE_INT, "TRACE");
  -  
  +   public static final TracePriority TRACE = new TracePriority(TRACE_INT, 
TRACE_STR, 7);
  +
  +   protected TracePriority(int level, String strLevel, int syslogEquiv)
  +   {
  +      super(level, strLevel, syslogEquiv);
  +   }
  +   
      /** 
       * Convert an integer passed as argument to a priority. If the conversion
       * fails, then this method returns the specified default.
  @@ -36,16 +45,28 @@
       */
      public static Priority toPriority(String name, Priority defaultPriority)
      {
  -      if( name == null )
  +      if (name == null)
  +         return defaultPriority;
  +
  +      String upper = name.toUpperCase();
  +      if (upper.equals(TRACE_STR)) {
            return TRACE;
  -      
  -      Priority p = TRACE;
  -      if( name.charAt(0) != 'T' )
  -         p = Priority.toPriority(name, defaultPriority);
  -      return p;
  +      }
  +
  +      return Priority.toPriority(name, defaultPriority);
      }
   
      /** 
  +    * Convert an integer passed as argument to a priority.
  +    * 
  +    * @return the Priority object for name if one exists
  +    */
  +   public static Priority toPriority(String name)
  +   {
  +      return toPriority(name, TRACE);
  +   }
  +   
  +   /** 
       * Convert an integer passed as argument to a priority. If the conversion
       * fails, then this method returns the specified default.
       * @return the Priority object for i if one exists, defaultPriority otherwize.
  @@ -58,10 +79,5 @@
         else
            p = Priority.toPriority(i);
         return p;
  -   }
  -
  -   protected TracePriority(int level, String strLevel)
  -   {
  -      super(level, strLevel, 7);
      }
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to