ws-wsif-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmu...@apache.org
Subject cvs commit: xml-axis-wsif/java/src/org/apache/wsif/logging Trc.java
Date Wed, 09 Apr 2003 17:02:43 GMT
nmukhi      2003/04/09 10:02:42

  Modified:    java/src/org/apache/wsif/base WSIFDefaultMessage.java
               java/src/org/apache/wsif/logging Trc.java
  Log:
  Adding Bill Nagy'sproposed logging changes; see
  http://marc.theaimsgroup.com/?l=wsif-dev&m=104929704118169&w=2 for details.
  
  Revision  Changes    Path
  1.12      +2 -2      xml-axis-wsif/java/src/org/apache/wsif/base/WSIFDefaultMessage.java
  
  Index: WSIFDefaultMessage.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFDefaultMessage.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WSIFDefaultMessage.java	12 Feb 2003 16:20:07 -0000	1.11
  +++ WSIFDefaultMessage.java	9 Apr 2003 17:02:42 -0000	1.12
  @@ -620,10 +620,10 @@
               if (parts==null)
                   buff += " parts:null";
               else 
  -                buff += Trc.brief(" parts",parts.values());
  +                buff += Trc.brief(Trc.LOG_LEVEL_INFO," parts",parts.values());
           } catch (Exception e) {
               Trc.exceptionInTrace(e);
           }
           return buff;
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.12      +86 -22    xml-axis-wsif/java/src/org/apache/wsif/logging/Trc.java
  
  Index: Trc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/logging/Trc.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Trc.java	7 Dec 2002 12:34:05 -0000	1.11
  +++ Trc.java	9 Apr 2003 17:02:42 -0000	1.12
  @@ -94,9 +94,37 @@
    * @author Mark Whitlock <whitlock@apache.org>
    */
   public class Trc {
  -	private static final String wsifPackageName = "org.apache.wsif";
  +    public static final int LOG_LEVEL_TRACE = 0;
  +    public static final int LOG_LEVEL_DEBUG = 1;
  +    public static final int LOG_LEVEL_INFO = 2;
  +    public static final int LOG_LEVEL_WARN = 3;
  +    public static final int LOG_LEVEL_ERROR = 4;
  +    public static final int LOG_LEVEL_FATAL = 5;
  +    private static final String wsifPackageName = "org.apache.wsif";
       private static Log log = LogFactory.getLog(wsifPackageName+".*");
       public static boolean ON = log.isDebugEnabled();
  +    private static int currentLogLevel;
  +
  +    static {
  +        if (log.isTraceEnabled()) {
  +            currentLogLevel = LOG_LEVEL_TRACE;
  +	}
  +	else if (log.isDebugEnabled()) {
  +            currentLogLevel = LOG_LEVEL_DEBUG;
  +	}
  +	else if (log.isInfoEnabled()) {
  +            currentLogLevel = LOG_LEVEL_INFO;
  +	}
  +	else if (log.isWarnEnabled()) {
  +            currentLogLevel = LOG_LEVEL_WARN;
  +	}
  +	else if (log.isErrorEnabled()) {
  +            currentLogLevel = LOG_LEVEL_ERROR;
  +	}
  +        else {
  +            currentLogLevel = LOG_LEVEL_FATAL;
  +	}
  +    }
   
       private static Log traceLog = LogFactory.getLog(wsifPackageName+".logging.*");
       /**
  @@ -813,8 +841,12 @@
       }
   
       public static String brief(Definition d) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, d);
  +    }
  +
  +    public static String brief(int outputLevel, Definition d) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (d == null)
                   return "null";
  @@ -828,8 +860,12 @@
       }
   
       public static String brief(PortType pt) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, pt);
  +    }
  +
  +    public static String brief(int outputLevel, PortType pt) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (pt == null)
                   return "null";
  @@ -843,8 +879,12 @@
       }
   
       public static String brief(Service s) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, s);
  +    }
  +
  +    public static String brief(int outputLevel, Service s) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (s == null)
                   return "null";
  @@ -858,8 +898,12 @@
       }
   
       public static String brief(Port p) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, p);
  +    }
  +
  +    public static String brief(int outputLevel, Port p) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (p == null)
                   return "null";
  @@ -873,8 +917,12 @@
       }
   
       public static String brief(BindingOperation bo) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, bo);
  +    }
  +
  +    public static String brief(int outputLevel, BindingOperation bo) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (bo == null)
                   return "null";
  @@ -888,8 +936,12 @@
       }
   
       public static String brief(Operation o) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, o);
  +    }
  +
  +    public static String brief(int outputLevel, Operation o) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (o == null)
                   return "null";
  @@ -903,23 +955,31 @@
       }
   
       public static String brief(String name, Collection coll) {
  -        try {
  -            if (!ON)
  -                return "";
  -            if (coll == null)
  -                return name + ":null";
  -            if (coll.size() == 0)
  -                return name + ":size(0)";
  -            return brief(name,coll.toArray());
  -        } catch (Exception e) {
  -            exceptionInTrace(e);
  -        }
  -        return "";
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, name, coll);
  +    }
  +
  +    public static String brief(int outputLevel, String name, Collection coll) {
  +      try {
  +	if (currentLogLevel > outputLevel)
  +	  return "";
  +	if (coll == null)
  +	  return name + ":null";
  +	if (coll.size() == 0)
  +	  return name + ":size(0)";
  +	return brief(outputLevel,name,coll.toArray());
  +      } catch (Exception e) {
  +	exceptionInTrace(e);
  +      }
  +      return "";
       }
   
       public static String brief(String name, Object[] objs) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, name, objs);
  +    }
  +
  +    public static String brief(int outputLevel, String name, Object[] objs) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (objs == null)
                   return name + ":null";
  @@ -948,8 +1008,12 @@
        * the elements of the map.
        */
       public static String brief(Map map) {
  +      return (!ON)?"":brief(LOG_LEVEL_DEBUG, map);
  +    }
  +
  +    public static String brief(int outputLevel, Map map) {
           try {
  -            if (!ON)
  +            if (currentLogLevel > outputLevel)
                   return "";
               if (map == null)
                   return "<null>";
  @@ -1243,4 +1307,4 @@
   
           log.debug(sb);
       }
  -}
  \ No newline at end of file
  +}
  
  
  

Mime
View raw message