Revision: 15679
Author: brainslog
Date: Wed Dec  8 08:32:17 2010
Log: Updating Diameter Dictionary logging.

Use StringBuffer and move verbous logging to TRACE level.
http://code.google.com/p/mobicents/source/detail?r=15679

Modified:
/trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java

=======================================
--- /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java Tue Nov 30 01:06:43 2010 +++ /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java Wed Dec 8 08:32:17 2010
@@ -376,8 +376,10 @@

       long endTime = System.currentTimeMillis();

- logger.info("AVP Validator :: Loaded in {}ms == Vendors[{}] Commands[{}] Types[{}] AVPs[{}]", - new Object[] { (endTime - startTime), vendorMap.size(), commandMap.size(), typedefMap.size(), avpMap.size() });
+      if(logger.isInfoEnabled()) {
+ logger.info("AVP Validator :: Loaded in {}ms == Vendors[{}] Commands[{}] Types[{}] AVPs[{}]", + new Object[] { (endTime - startTime), vendorMap.size(), commandMap.size(), typedefMap.size(), avpMap.size() });
+      }

       if (logger.isInfoEnabled()) {
         StringBuffer sb = new StringBuffer();
@@ -390,7 +392,7 @@
         }

         if (c > 0) {
- sb.append("------- TOTAL INCOMPLETE AVPS COUNT: " + c + " -------"); + sb.append("------- TOTAL INCOMPLETE AVPS COUNT: ").append(c).append(" -------");
           logger.info(sb.toString());
         }
       }
@@ -610,10 +612,10 @@

                     if (!groupedChildWeakElement.hasAttribute("name")) {
                       if (logger.isDebugEnabled()) {
- logger.debug("[ERROR] Grouped child does not have name, grouped avp: Name[" + avpName + "] Description[" - + avpDescription + "] Code[" + avpCode + "] May-Encrypt[" + avpMayEncrypt + "] Mandatory[" - + avpMandatory + "] Protected [" + avpProtected + "] Vendor-Bit [" + avpVendorBit + "] Vendor-Id [" - + avpVendorId + "] Constrained[" + avpConstrained + "] Type [" + avpType + "]"); + logger.debug(new StringBuffer("[ERROR] Grouped child does not have name, grouped avp: Name[").append(avpName).append("] Description["). + append(avpDescription).append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory["). + append(avpMandatory).append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id ["). + append(avpVendorId).append("] Constrained[").append(avpConstrained).append("] Type [").append(avpType).append("]").toString());
                       }
                       continue;
                     }
@@ -654,10 +656,12 @@
             }
           }

-          if (logger.isDebugEnabled()) {
- logger.debug("Parsed AVP: Name[" + avpName + "] Description[" + avpDescription + "] Code[" + avpCode + "] May-Encrypt[" + avpMayEncrypt - + "] Mandatory[" + avpMandatory + "] Protected [" + avpProtected + "] Vendor-Bit [" + avpVendorBit + "] Vendor-Id [" - + avpVendorId + "] Constrained[" + avpConstrained + "] Type [" + avpType + "]");
+          if (logger.isTraceEnabled()) {
+ logger.trace(new StringBuffer("Parsed AVP: Name[").append(avpName).append("] Description[").append(avpDescription). + append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory["). + append(avpMandatory).append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit). + append("] Vendor-Id [").append(avpVendorId).append("] Constrained[").append(avpConstrained).append("] Type [").
+                append(avpType).append("]").toString());
           }

           try {
@@ -685,9 +689,7 @@
           }
           catch (Exception e) {
             if (logger.isDebugEnabled()) {
- logger.debug("[ERROR] Failed Parsing AVP: Name[" + avpName + "] Description[" + avpDescription + "] Code[" + avpCode - + "] May-Encrypt[" + avpMayEncrypt + "] Mandatory[" + avpMandatory + "] Protected [" + avpProtected + "] Vendor-Bit [" - + avpVendorBit + "] Vendor-Id [" + avpVendorId + "] Constrained[" + avpConstrained + "] Type [" + avpType + "]", e); + logger.debug(new StringBuffer("[ERROR] Failed Parsing AVP: Name[").append(avpName).append("] Description[").append(avpDescription).append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory[").append(avpMandatory).append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id [").append(avpVendorId).append("] Constrained[").append(avpConstrained).append("] Type [").append(avpType).append("]").toString(), e);
             }
           }
         }
@@ -827,8 +829,7 @@
         strongRep = (AvpRepresentationImpl) avpMap.get(strongKey);

         if (strongRep == null || strongRep.isWeak()) {
- logger.debug("Resolving weak link for: {}; Strong representation for name: {} does not exist V:[{}]!",
-              new Object[] { groupedAvp, local.getName(), strongRep });
+ logger.trace("Resolving weak link for: {}; Strong representation for name: {} does not exist V:[{}]!", new Object[] { groupedAvp, local.getName(), strongRep });
           hasWeaklings = true;
         }
         else {

Reply via email to