improve server-side logging of exceptions
[sfa.git] / sfa / util / method.py
index 473bcd1..484b77b 100644 (file)
@@ -14,10 +14,11 @@ import textwrap
 import xmlrpclib
 
 
+import sfa.util.sfalogging
 from sfa.util.faults import * 
 from sfa.util.parameter import Parameter, Mixed, python_type, xmlrpc_type
 from sfa.trust.auth import Auth
-from sfa.util.debug import profile, log
+#from sfa.util.debug import profile, log
 
 # we inherit object because we use new-style classes for legacy methods
 class Method (object):
@@ -91,9 +92,10 @@ class Method (object):
             runtime = time.time() - start
 
             if self.api.config.SFA_API_DEBUG or hasattr(self, 'message'):
+                msg=getattr(self,'message',"method %s completed"%methodname)
+                sfa.util.sfalogging.logger.info(msg)
                 # XX print to some log file
                 # print >> log, "some output"
-                   pass
 
             return result
 
@@ -104,9 +106,9 @@ class Method (object):
             # Prepend caller and method name to expected faults
             fault.faultString = caller + ": " +  self.name + ": " + fault.faultString
             runtime = time.time() - start
-           
-            if self.api.config.SFA_API_DEBUG:
-                traceback.print_exc()
+#            if self.api.config.SFA_API_DEBUG:
+#                traceback.print_exc()
+            sfa.util.sfalogging.log_exc("Method %s raised an exception"%self.name) 
             raise fault