axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <t...@macromedia.com>
Subject RE: using log4j
Date Thu, 18 Oct 2001 14:41:11 GMT
A real minor nit, not worth changing in this case but useful FYI.

You don't need to write this:

  if (category.isDebugEnabled()) {
    category.debug("In ArraySerializer.startElement()");
  }

When it could be this:

  category.debug("In ArraySerializer.startElement()");

Having just read the log4j docs, the only reason you would check the
isDebugEnabled() function is when you have an expensive construction as an
argument to the category call.  I would define "expensive" as more than 1 or
2 additions.

IMHO, having the if clause just clutters up the code.

See http://jakarta.apache.org/log4j/docs/FAQ.html  - The question "What is
the fastest way of (not) logging?".

--
Tom Jordahl


-----Original Message-----
From: dims@apache.org [mailto:dims@apache.org]
Sent: Thursday, October 18, 2001 10:10 AM
To: xml-axis-cvs@apache.org
Subject: cvs commit: xml-axis/java/src/org/apache/axis/utils
NSStack.java


dims        01/10/18 07:10:29

  Modified:    java/src/org/apache/axis SimpleTargetedChain.java
               java/src/org/apache/axis/encoding ArraySerializer.java
                        DeserializationContext.java
                        SerializationContext.java VectorDeserializer.java
               java/src/org/apache/axis/message BodyBuilder.java
                        MessageElement.java RPCHandler.java RPCParam.java
                        SAXOutputter.java SOAPEnvelope.java
               java/src/org/apache/axis/providers/java JavaProvider.java
                        RPCProvider.java
               java/src/org/apache/axis/registries SupplierRegistry.java
               java/src/org/apache/axis/utils NSStack.java
  Log:
  Eliminating DEBUG_LOG+System.out/err.println with log4j's category.
  
  Revision  Changes    Path
  1.23      +1 -1
xml-axis/java/src/org/apache/axis/SimpleTargetedChain.java
  
  Index: SimpleTargetedChain.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/SimpleTargetedChain.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SimpleTargetedChain.java	2001/10/16 19:00:02	1.22
  +++ SimpleTargetedChain.java	2001/10/18 14:10:28	1.23
  @@ -69,7 +69,7 @@
    */
   public class SimpleTargetedChain extends BasicHandler implements
TargetedChain
   {
  -    static Category category =
  +   static Category category =
               Category.getInstance(SimpleTargetedChain.class.getName());
   
       protected Handler    requestHandler ;
  
  
  
  1.18      +13 -11
xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ArraySerializer.java	2001/10/03 15:30:04	1.17
  +++ ArraySerializer.java	2001/10/18 14:10:28	1.18
  @@ -58,6 +58,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.message.SOAPHandler;
   import org.apache.axis.utils.QName;
  +import org.apache.log4j.Category;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
  @@ -79,7 +80,8 @@
   public class ArraySerializer extends Deserializer
       implements ValueReceiver, Serializer
   {
  -    private final static boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(ArraySerializer.class.getName());
   
       static Hashtable primitives = new Hashtable();
       static {
  @@ -109,8 +111,8 @@
                                DeserializationContext context)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("In ArraySerializer.startElement()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In ArraySerializer.startElement()");
           }
   
           if (attributes.getValue(Constants.URI_CURRENT_SCHEMA_XSI,  "nil")
!= null) {
  @@ -206,8 +208,8 @@
 
rightBracketIndex));
           }
           
  -        if (DEBUG_LOG) {
  -            System.err.println("Out ArraySerializer.startElement()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out ArraySerializer.startElement()");
           }
       }
       
  @@ -218,8 +220,8 @@
                                       DeserializationContext context)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("In ArraySerializer.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In ArraySerializer.onStartChild()");
           }
           
           if (attributes != null) {
  @@ -253,16 +255,16 @@
                                           getDeserializer(itemType);
           dSer.registerCallback(this, new Integer(curIndex++));
           
  -        if (DEBUG_LOG) {
  -            System.err.println("Out ArraySerializer.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out ArraySerializer.onStartChild()");
           }
           return dSer;
       }
       
       public void valueReady(Object value, Object hint)
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("ArraySerializer got value [" + hint +
  +        if (category.isDebugEnabled()) {
  +            category.debug("ArraySerializer got value [" + hint +
                                  "] = " + value);
           }
           ((ArrayList)this.value).set(((Integer)hint).intValue(), value);
  
  
  
  1.28      +21 -19
xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
  
  Index: DeserializationContext.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.
java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DeserializationContext.java	2001/10/17 14:01:06	1.27
  +++ DeserializationContext.java	2001/10/18 14:10:28	1.28
  @@ -68,6 +68,7 @@
   import org.apache.axis.utils.NSStack;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.log4j.Category;
   import org.xml.sax.Attributes;
   import org.xml.sax.InputSource;
   import org.xml.sax.Locator;
  @@ -86,7 +87,8 @@
   
   public class DeserializationContext extends DefaultHandler
   {
  -    private static final boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(DeserializationContext.class.getName());
       
       static class LocalIDResolver implements IDResolver
       {
  @@ -393,8 +395,8 @@
       
       public void pushElementHandler(SOAPHandler handler)
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("Pushing handler " + handler);
  +        if (category.isDebugEnabled()) {
  +            category.debug("Pushing handler " + handler);
           }
           
           handlerStack.push(handler);
  @@ -416,14 +418,14 @@
       {
           if (!handlerStack.empty()) {
               SOAPHandler handler = getTopHandler();
  -            if (DEBUG_LOG) {
  -                System.out.println("Popping handler " + handler);
  +            if (category.isDebugEnabled()) {
  +                category.debug("Popping handler " + handler);
               }
               handlerStack.pop();
               return handler;
           } else {
  -            if (DEBUG_LOG) {
  -                System.out.println("Popping handler...(null)");
  +            if (category.isDebugEnabled()) {
  +                category.debug("Popping handler...(null)");
               }
               return null;
           }
  @@ -439,8 +441,8 @@
       }
       
       public void endDocument() throws SAXException {
  -        if (DEBUG_LOG) {
  -            System.err.println("EndDocument");
  +        if (category.isDebugEnabled()) {
  +            category.debug("EndDocument");
           }
           if (recorder != null)
               recorder.endDocument();
  @@ -471,8 +473,8 @@
               namespaces.add(uri, "");
           }
          
  -        if (DEBUG_LOG) {
  -            System.err.println("StartPrefixMapping '" + prefix + "'->'" +
uri + "'");
  +        if (category.isDebugEnabled()) {
  +            category.debug("StartPrefixMapping '" + prefix + "'->'" + uri
+ "'");
           }
           
           SOAPHandler handler = getTopHandler();
  @@ -483,8 +485,8 @@
       public void endPrefixMapping(String prefix)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("EndPrefixMapping '" + prefix + "'");
  +        if (category.isDebugEnabled()) {
  +            category.debug("EndPrefixMapping '" + prefix + "'");
           }
           
           if (recorder != null)
  @@ -542,8 +544,8 @@
       {
           SOAPHandler nextHandler = null;
   
  -        if (DEBUG_LOG) {
  -            System.out.println("startElement ['" + namespace + "' " +
  +        if (category.isDebugEnabled()) {
  +            category.debug("startElement ['" + namespace + "' " +
                              localName + "]");
           }
           
  @@ -584,8 +586,8 @@
       public void endElement(String namespace, String localName, String
qName)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("endElement ['" + namespace + "' " +
  +        if (category.isDebugEnabled()) {
  +            category.debug("endElement ['" + namespace + "' " +
                              localName + "]");
           }
           
  @@ -600,8 +602,8 @@
                   getTopHandler().onEndChild(namespace, localName, this);
               } else {
                   // We should be done!
  -                if (DEBUG_LOG) {
  -                    System.out.println("Done with document!");
  +                if (category.isDebugEnabled()) {
  +                    category.debug("Done with document!");
                   }
               }
               
  
  
  
  1.43      +9 -7
xml-axis/java/src/org/apache/axis/encoding/SerializationContext.java
  
  Index: SerializationContext.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContext.ja
va,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- SerializationContext.java	2001/10/17 14:01:06	1.42
  +++ SerializationContext.java	2001/10/18 14:10:28	1.43
  @@ -63,6 +63,7 @@
   import org.apache.axis.utils.NSStack;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.log4j.Category;
   import org.w3c.dom.Attr;
   import org.w3c.dom.Element;
   import org.w3c.dom.NamedNodeMap;
  @@ -90,7 +91,8 @@
    */
   public class SerializationContext
   {
  -    private static final boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(SerializationContext.class.getName());
   
       public NSStack nsStack = new NSStack();
   
  @@ -221,8 +223,8 @@
   
       public void registerPrefixForURI(String prefix, String uri)
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("register '" + prefix + "' - '" + uri +
"'");
  +        if (category.isDebugEnabled()) {
  +            category.debug("register '" + prefix + "' - '" + uri + "'");
           }
   
           if ((uri != null) && (prefix != null)) {
  @@ -349,8 +351,8 @@
       public void startElement(QName qName, Attributes attributes)
           throws IOException
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("Out: Starting element [" +
qName.getNamespaceURI() + "]:" + qName.getLocalPart());
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out: Starting element [" +
qName.getNamespaceURI() + "]:" + qName.getLocalPart());
           }
   
           if (startOfDocument && sendXMLDecl) {
  @@ -433,8 +435,8 @@
       {
           String elementQName = (String)elementStack.pop();
   
  -        if (DEBUG_LOG) {
  -            System.out.println("Out: Ending element " + elementQName);
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out: Ending element " + elementQName);
           }
   
           nsStack.pop();
  
  
  
  1.2       +13 -11
xml-axis/java/src/org/apache/axis/encoding/VectorDeserializer.java
  
  Index: VectorDeserializer.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/VectorDeserializer.java
,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VectorDeserializer.java	2001/10/04 16:49:08	1.1
  +++ VectorDeserializer.java	2001/10/18 14:10:28	1.2
  @@ -58,6 +58,7 @@
   import org.apache.axis.*;
   import org.apache.axis.message.SOAPHandler;
   import org.apache.axis.utils.*;
  +import org.apache.log4j.Category;
   import org.xml.sax.*;
   import java.util.Vector;
   
  @@ -71,7 +72,8 @@
   public class VectorDeserializer extends Deserializer
   implements ValueReceiver {
   
  -    private final static boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(VectorDeserializer.class.getName());
   
       public static class Factory implements DeserializerFactory {
           public Deserializer getDeserializer(Class cls) {
  @@ -84,8 +86,8 @@
                                String qName, Attributes attributes,
                                DeserializationContext context)
       throws SAXException {
  -        if (DEBUG_LOG) {
  -            System.err.println("In VectorDeserializer.startElement()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In VectorDeserializer.startElement()");
           }
   
           if (attributes.getValue(Constants.URI_CURRENT_SCHEMA_XSI,  "nil")
!= null) {
  @@ -94,8 +96,8 @@
   
           this.value = new java.util.Vector();
   
  -        if (DEBUG_LOG) {
  -            System.err.println("Out VectorDeserializer.startElement()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out VectorDeserializer.startElement()");
           }
       }
   
  @@ -105,8 +107,8 @@
                                       Attributes attributes,
                                       DeserializationContext context)
       throws SAXException {
  -        if (DEBUG_LOG) {
  -            System.err.println("In VectorDeserializer.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In VectorDeserializer.onStartChild()");
           }
   
           if (attributes == null)
  @@ -127,16 +129,16 @@
                                           getDeserializer(itemType);
           dSer.registerCallback(this, null);
   
  -        if (DEBUG_LOG) {
  -            System.err.println("Out VectorDeserializer.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out VectorDeserializer.onStartChild()");
           }
           return dSer;
       }
   
       public void valueReady(Object value, Object hint)
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("VectorDeserializer got value = " +
value);
  +        if (category.isDebugEnabled()) {
  +            category.debug("VectorDeserializer got value = " + value);
           }
           ((Vector)this.value).add(value);
       }
  
  
  
  1.9       +8 -10
xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
  
  Index: BodyBuilder.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BodyBuilder.java	2001/10/16 13:25:52	1.8
  +++ BodyBuilder.java	2001/10/18 14:10:29	1.9
  @@ -17,8 +17,6 @@
       static Category category =
               Category.getInstance(BodyBuilder.class.getName());
   
  -    private final static boolean DEBUG_LOG = false;
  -    
       private SOAPBodyElement element;
       boolean gotRPCElement = false;
       boolean isRPCElement = false;
  @@ -37,8 +35,8 @@
                                        DeserializationContext context)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("In BodyBuilder.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In BodyBuilder.onStartChild()");
           }
           SOAPHandler handler = null;
           
  @@ -93,8 +91,8 @@
           
           handler.myElement = element;
           
  -        if (DEBUG_LOG) {
  -            System.err.println("Out BodyBuilder.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out BodyBuilder.onStartChild()");
           }
           return handler;
       }
  @@ -102,8 +100,8 @@
       public void onEndChild(String namespace, String localName,
                              DeserializationContext context)
       {
  -        if (DEBUG_LOG) {
  -            System.err.println("In BodyBuilder.onEndChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In BodyBuilder.onEndChild()");
           }
           
           if (element != null) {
  @@ -111,8 +109,8 @@
               element = null;
           }
   
  -        if (DEBUG_LOG) {
  -            System.err.println("Out BodyBuilder.onEndChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out BodyBuilder.onEndChild()");
           }
       }
   }
  
  
  
  1.49      +8 -6
xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- MessageElement.java	2001/10/17 14:01:06	1.48
  +++ MessageElement.java	2001/10/18 14:10:29	1.49
  @@ -67,6 +67,7 @@
   import org.apache.axis.utils.Mapping;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.XMLUtils;
  +import org.apache.log4j.Category;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.xml.sax.Attributes;
  @@ -83,7 +84,8 @@
   
   public class MessageElement
   {
  -    private static final boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(MessageElement.class.getName());
   
       protected String    name ;
       protected String    prefix ;
  @@ -137,10 +139,10 @@
       public MessageElement(String namespace, String localPart, String
qName,
                      Attributes attributes, DeserializationContext context)
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("New MessageElement (" + this + ") named "
+ qName);
  +        if (category.isDebugEnabled()) {
  +            category.debug("New MessageElement (" + this + ") named " +
qName);
               for (int i = 0; attributes != null && i <
attributes.getLength(); i++) {
  -                System.out.println("  " + attributes.getQName(i) + " = '"
+ attributes.getValue(i) + "'");
  +                category.debug("  " + attributes.getQName(i) + " = '" +
attributes.getValue(i) + "'");
               }
           }
           this.namespaceURI = namespace;
  @@ -275,8 +277,8 @@
           if (parent != null)
               return parent.getNamespaceURI(prefix);
   
  -        if (DEBUG_LOG) {
  -            System.err.println(this + " didn't find prefix '" + prefix +
"'");
  +        if (category.isDebugEnabled()) {
  +            category.debug(this + " didn't find prefix '" + prefix +
"'");
           }
   
           return null;
  
  
  
  1.9       +17 -15
xml-axis/java/src/org/apache/axis/message/RPCHandler.java
  
  Index: RPCHandler.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/RPCHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RPCHandler.java	2001/10/16 13:25:52	1.8
  +++ RPCHandler.java	2001/10/18 14:10:29	1.9
  @@ -15,6 +15,7 @@
   import org.apache.axis.utils.AxisClassLoader;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.cache.JavaClass;
  +import org.apache.log4j.Category;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   
  @@ -23,7 +24,8 @@
   
   public class RPCHandler extends SOAPHandler
   {
  -    private final static boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(RPCHandler.class.getName());
       
       private RPCElement call;
       private RPCParam currentParam;
  @@ -49,8 +51,8 @@
               JavaClass       jc     = cl.lookup(clsName);
               Class           cls    = jc.getJavaClass();
               
  -            if (DEBUG_LOG) {
  -                System.err.println("Looking up method '" + methodName +
  +            if (category.isDebugEnabled()) {
  +                category.debug("Looking up method '" + methodName +
                                      "' in class " + clsName);
               }
   
  @@ -89,8 +91,8 @@
 
context.getMessageContext().
 
getProperty(MessageContext.SERVICE_DESCRIPTION);
           
  -        if (DEBUG_LOG) {
  -            System.err.println("In RPCHandler.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("In RPCHandler.onStartChild()");
           }
           
           Vector params = call.getParams();
  @@ -105,8 +107,8 @@
           QName type = context.getTypeFromAttributes(namespace,
                                                      localName,
                                                      attributes);
  -        if (DEBUG_LOG) {
  -            System.err.println("Type from attrs was " + type);
  +        if (category.isDebugEnabled()) {
  +            category.debug("Type from attrs was " + type);
           }
           
           // xsi:type always overrides everything else
  @@ -116,8 +118,8 @@
               if (serviceDesc != null) {
                   String msgType = context.getEnvelope().getMessageType();
                   type = serviceDesc.getParamTypeByName(msgType,
localName);
  -                if (DEBUG_LOG) {
  -                    System.err.println("Type from service desc was " +
type);
  +                if (category.isDebugEnabled()) {
  +                    category.debug("Type from service desc was " + type);
                   }
               }
               
  @@ -133,8 +135,8 @@
                   if (index+1<defaultParamTypes.length)
                       if (defaultParamTypes[0]==MessageContext.class)
index++;
                   type = typeMap.getTypeQName(defaultParamTypes[index]);
  -                if (DEBUG_LOG) {
  -                    System.err.println("Type from default parms was " +
type);
  +                if (category.isDebugEnabled()) {
  +                    category.debug("Type from default parms was " +
type);
                   }
               }
           }
  @@ -158,8 +160,8 @@
                      RPCParam.getValueField()));
           }
           
  -        if (DEBUG_LOG) {
  -            System.out.println("Out RPCHandler.onStartChild()");
  +        if (category.isDebugEnabled()) {
  +            category.debug("Out RPCHandler.onStartChild()");
           }
           return dser;
       }
  @@ -168,8 +170,8 @@
                              DeserializationContext context)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("Setting MessageContext property in " +
  +        if (category.isDebugEnabled()) {
  +            category.debug("Setting MessageContext property in " +
                                  "RPCHandler.endElement().");
           }
           context.getMessageContext().setProperty("RPC", call);
  
  
  
  1.23      +0 -2
xml-axis/java/src/org/apache/axis/message/RPCParam.java
  
  Index: RPCParam.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/RPCParam.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- RPCParam.java	2001/10/03 15:30:05	1.22
  +++ RPCParam.java	2001/10/18 14:10:29	1.23
  @@ -67,8 +67,6 @@
    */
   public class RPCParam
   {
  -    private static boolean DEBUG_LOG = false;
  -    
       // Who's your daddy?
       RPCElement myCall;
       
  
  
  
  1.5       +11 -9
xml-axis/java/src/org/apache/axis/message/SAXOutputter.java
  
  Index: SAXOutputter.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/SAXOutputter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SAXOutputter.java	2001/10/03 15:30:05	1.4
  +++ SAXOutputter.java	2001/10/18 14:10:29	1.5
  @@ -2,6 +2,7 @@
   
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.utils.QName;
  +import org.apache.log4j.Category;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.DefaultHandler;
  @@ -10,7 +11,8 @@
   
   public class SAXOutputter extends DefaultHandler
   {
  -    private static final boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(SAXOutputter.class.getName());
       
       SerializationContext context;
       
  @@ -23,8 +25,8 @@
       }
       
       public void endDocument() throws SAXException {
  -        if (DEBUG_LOG) {
  -            System.out.println("SAXOutputter: end document.");
  +        if (category.isDebugEnabled()) {
  +            category.debug("SAXOutputter: end document.");
           }
       }
       
  @@ -37,8 +39,8 @@
       }
       
       public void characters(char[] p1, int p2, int p3) throws SAXException
{
  -        if (DEBUG_LOG) {
  -            System.out.println("(out) characters ['" +
  +        if (category.isDebugEnabled()) {
  +            category.debug("(out) characters ['" +
                                  new String(p1, p2, p3) + "']");
           }
           try {
  @@ -65,8 +67,8 @@
                                String qName, Attributes attributes)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("(out) startElement ['" + namespace + "' "
+
  +        if (category.isDebugEnabled()) {
  +            category.debug("(out) startElement ['" + namespace + "' " +
                              localName + "]");
           }
   
  @@ -80,8 +82,8 @@
       public void endElement(String namespace, String localName, String
qName)
           throws SAXException
       {
  -        if (DEBUG_LOG) {
  -            System.out.println("(out) endElement ['" + namespace + "' " +
  +        if (category.isDebugEnabled()) {
  +            category.debug("(out) endElement ['" + namespace + "' " +
                              localName + "]");
           }
           
  
  
  
  1.38      +21 -20
xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
  
  Index: SOAPEnvelope.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- SOAPEnvelope.java	2001/10/17 14:01:06	1.37
  +++ SOAPEnvelope.java	2001/10/18 14:10:29	1.38
  @@ -59,16 +59,16 @@
   import org.apache.axis.Constants;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
  -import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.client.AxisClient;
   import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.utils.Mapping;
   import org.apache.axis.utils.QName;
  -import org.xml.sax.helpers.AttributesImpl;
  +import org.apache.log4j.Category;
   import org.xml.sax.InputSource;
  -import org.apache.axis.client.AxisClient ;
  +import org.xml.sax.helpers.AttributesImpl;
   
  -import java.io.InputStream ;
  -import java.io.StringWriter;
  +import java.io.InputStream;
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.Iterator;
  @@ -76,7 +76,8 @@
   
   public class SOAPEnvelope extends MessageElement
   {
  -    private static boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(SOAPEnvelope.class.getName());
       
       public Vector headers = new Vector();
       public Vector bodyElements = new Vector();
  @@ -169,8 +170,8 @@
       
       public void addHeader(SOAPHeader header)
       {
  -        if (DEBUG_LOG)
  -            System.out.println("Adding header to message...");
  +        if (category.isDebugEnabled())
  +            category.debug("Adding header to message...");
           header.setEnvelope(this);
           headers.addElement(header);
           _isDirty = true;
  @@ -178,8 +179,8 @@
       
       public void addBodyElement(SOAPBodyElement element)
       {
  -        if (DEBUG_LOG)
  -            System.out.println("Adding body element to message...");
  +        if (category.isDebugEnabled())
  +            category.debug("Adding body element to message...");
           element.setEnvelope(this);
           bodyElements.addElement(element);
           _isDirty = true;
  @@ -187,24 +188,24 @@
       
       public void removeHeader(SOAPHeader header)
       {
  -        if (DEBUG_LOG)
  -            System.out.println("Removing header from message...");
  +        if (category.isDebugEnabled())
  +            category.debug("Removing header from message...");
           headers.removeElement(header);
           _isDirty = true;
       }
       
       public void removeBodyElement(SOAPBodyElement element)
       {
  -        if (DEBUG_LOG)
  -            System.out.println("Removing body element from message...");
  +        if (category.isDebugEnabled())
  +            category.debug("Removing body element from message...");
           bodyElements.removeElement(element);
           _isDirty = true;
       }
       
       public void removeTrailer(MessageElement element)
       {
  -        if (DEBUG_LOG)
  -            System.out.println("Removing trailer from message...");
  +        if (category.isDebugEnabled())
  +            category.debug("Removing trailer from message...");
           trailers.removeElement(element);
           _isDirty = true;
       }
  @@ -218,8 +219,8 @@
       
       public void addTrailer(MessageElement element)
       {
  -        if (DEBUG_LOG)
  -            System.out.println("Adding trailer to message...");
  +        if (category.isDebugEnabled())
  +            category.debug("Adding trailer to message...");
           element.setEnvelope(this);
           trailers.addElement(element);
           _isDirty = true;
  @@ -311,8 +312,8 @@
           context.startElement(new QName(Constants.URI_SOAP_ENV,
                                          Constants.ELEM_ENVELOPE), attrs);
           
  -        if (DEBUG_LOG)
  -            System.out.println(headers.size() + " headers");
  +        if (category.isDebugEnabled())
  +            category.debug(headers.size() + " headers");
           
           if (!headers.isEmpty()) {
               // Output <SOAP-ENV:Header>
  
  
  
  1.21      +0 -2
xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
  
  Index: JavaProvider.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- JavaProvider.java	2001/10/03 15:30:06	1.20
  +++ JavaProvider.java	2001/10/18 14:10:29	1.21
  @@ -88,8 +88,6 @@
       public static final String OPTION_IS_STATIC = "isStatic";
       public static final String OPTION_CLASSPATH = "classPath";
   
  -    private static final boolean DEBUG_LOG = false;
  -
       private String classNameOption = "className";
       private String allowedMethodsOption = "methodName";
   
  
  
  
  1.22      +0 -2
xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
  
  Index: RPCProvider.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,
v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- RPCProvider.java	2001/10/03 15:30:06	1.21
  +++ RPCProvider.java	2001/10/18 14:10:29	1.22
  @@ -80,8 +80,6 @@
       static Category category =
               Category.getInstance(RPCProvider.class.getName());
   
  -    private static final boolean DEBUG_LOG = false;
  -    
       public void processMessage (MessageContext msgContext,
                                   String serviceName,
                                   String allowedMethods,
  
  
  
  1.14      +4 -6
xml-axis/java/src/org/apache/axis/registries/SupplierRegistry.java
  
  Index: SupplierRegistry.java
  ===================================================================
  RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/registries/SupplierRegistry.java
,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SupplierRegistry.java	2001/10/03 15:30:06	1.13
  +++ SupplierRegistry.java	2001/10/18 14:10:29	1.14
  @@ -74,8 +74,6 @@
       static Category category =
               Category.getInstance(SupplierRegistry.class.getName());
   
  -    private static final boolean DEBUG_LOG = false;
  -    
       protected Hashtable  suppliers = null ;
       
       public SupplierRegistry()
  @@ -86,16 +84,16 @@
        * Add a new Handler to the registry.
        */
       public void add(String key, Handler handler) {
  -        if (DEBUG_LOG)
  -            System.out.println("Registry " + this + " adding '" + key +
  +        if (category.isDebugEnabled())
  +            category.debug("Registry " + this + " adding '" + key +
                                  "' (" + handler + ")");
           if ( suppliers == null ) suppliers = new Hashtable();
           suppliers.put( key, new SimpleSupplier(handler) );
       }
       
       public void add(String key, Supplier supplier) {
  -        if (DEBUG_LOG)
  -            System.out.println("Registry " + this + " adding '" + key +
  +        if (category.isDebugEnabled())
  +            category.debug("Registry " + this + " adding '" + key +
                                  "' (" + supplier + ")");
           if ( suppliers == null ) suppliers = new Hashtable();
           suppliers.put( key, supplier );
  
  
  
  1.11      +14 -11    xml-axis/java/src/org/apache/axis/utils/NSStack.java
  
  Index: NSStack.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/NSStack.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NSStack.java	2001/10/03 15:30:07	1.10
  +++ NSStack.java	2001/10/18 14:10:29	1.11
  @@ -54,6 +54,8 @@
    */
   package org.apache.axis.utils;
   
  +import org.apache.log4j.Category;
  +
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.Stack;
  @@ -63,7 +65,8 @@
    * @author Glen Daniels (gdaniels@macromedia.com)
    */
   public class NSStack {
  -    private static final boolean DEBUG_LOG = false;
  +    static Category category =
  +            Category.getInstance(NSStack.class.getName());
       
       private static final ArrayList EMPTY = new ArrayList();
   
  @@ -83,15 +86,15 @@
       
       public void push() {
           if (stack == null) stack = new Stack();
  -        if (DEBUG_LOG)
  -            System.out.println("NSPush (" + stack.size() + ")");
  +        if (category.isDebugEnabled())
  +            category.debug("NSPush (" + stack.size() + ")");
           stack.push(EMPTY);
       }
       
       public void push(ArrayList table) {
           if (stack == null) stack = new Stack();
  -        if (DEBUG_LOG)
  -            System.out.println("NSPush (" + stack.size() + ")");
  +        if (category.isDebugEnabled())
  +            category.debug("NSPush (" + stack.size() + ")");
           if (table.size() == 0) 
              stack.push(EMPTY);
           else
  @@ -111,16 +114,16 @@
       
       public ArrayList pop() {
           if (stack.isEmpty()) {
  -            if (DEBUG_LOG)
  -                System.out.println("NSPop (empty)");
  +            if (category.isDebugEnabled())
  +                category.debug("NSPop (empty)");
               if (parent != null)
                   return parent.pop();
               return null;
           }
           
  -        if (DEBUG_LOG) {
  +        if (category.isDebugEnabled()){
               ArrayList t = (ArrayList)stack.pop();
  -            System.out.println("NSPop (" + stack.size() + ")");
  +            category.debug("NSPop (" + stack.size() + ")");
               return t;
           } else {
               return (ArrayList)stack.pop();
  @@ -195,8 +198,8 @@
           if (parent != null)
               return parent.getNamespaceURI(prefix);
   
  -        if (DEBUG_LOG) {
  -            System.err.println("didn't find prefix '" + prefix + "'");
  +        if (category.isDebugEnabled()){
  +            category.debug("didn't find prefix '" + prefix + "'");
               dump();
           }
   
  
  
  

Mime
View raw message