Repository: rucio/rucio

Issue:
Python 2.6 incompatibility with python logger
Motivation
----------

```
[desilva@atlas-sl6x64 t1]$ rucio --verbose  get user.desilva:user.desilva.dataset.1d45168b-551a-451f-bb73-5c633641c03b
2018-07-09 11:09:03,073	INFO	Processing 1 item(s) for input
2018-07-09 11:09:03,073	DEBUG	Processing item user.desilva:user.desilva.dataset.1d45168b-551a-451f-bb73-5c633641c03b
2018-07-09 11:09:03,074	DEBUG	RSE-Expression: istape=False
2018-07-09 11:09:03,074	DEBUG	Splitted DID: user.desilva:user.desilva.dataset.1d45168b-551a-451f-bb73-5c633641c03b
2018-07-09 11:09:03,247	DEBUG	1 DIDs after processing input
2018-07-09 11:09:03,247	DEBUG	Processing: {'name': 'user.desilva.dataset.1d45168b-551a-451f-bb73-5c633641c03b', 'did': 'user.desilva:user.desilva.dataset.1d45168b-551a-451f-bb73-5c633641c03b', 'rse': 'istape=False', 'no_subdir': False, 'nrandom': None, 'transfer_timeout': 3600, 'scope': 'user.desilva', 'type': u'DATASET', 'force_scheme': None, 'base_dir': '.'}
2018-07-09 11:09:03,492	DEBUG	Queueing file: user.desilva:myFile.1d45168b-551a-451f-bb73-5c633641c03b.log
2018-07-09 11:09:03,493	INFO	Using main thread to download 1 file(s)
2018-07-09 11:09:03,493	DEBUG	Start processing queued downloads
2018-07-09 11:09:03,494	INFO	Preparing download of user.desilva:myFile.1d45168b-551a-451f-bb73-5c633641c03b.log
2018-07-09 11:09:04,206	INFO	Trying to download with root from TRIUMF-LCG2_SCRATCHDISK: user.desilva:myFile.1d45168b-551a-451f-bb73-5c633641c03b.log 
2018-07-09 11:09:04,454	ERROR	Failed to download item
2018-07-09 11:09:04,454	DEBUG	Logger instance has no attribute 'getChild'
2018-07-09 11:09:04,454	ERROR	An unknown exception occurred.
Details: 1 items were in the input queue but only 0 are in the output queue
Completed in 2.3565 sec.
```


Discussion:

Resolving patch:
diff --git a/lib/rucio/client/uploadclient.py b/lib/rucio/client/uploadclient.py
--- a/lib/rucio/client/uploadclient.py
+++ b/lib/rucio/client/uploadclient.py
@@ -185,7 +185,7 @@ def upload(self, items, summary_file_path=None):
                 self.trace['clientState'] = 'DONE'
                 file['state'] = 'A'
                 logger.info('Successfully uploaded file %s' % basename)
-                send_trace(self.trace, self.client.host, self.client.user_agent, logger=logger)
+                send_trace(self.trace, self.client.host, self.client.user_agent)
 
                 if summary_file_path:
                     summary.append(copy.deepcopy(file))
diff --git a/lib/rucio/common/utils.py b/lib/rucio/common/utils.py
--- a/lib/rucio/common/utils.py
+++ b/lib/rucio/common/utils.py
@@ -32,7 +32,6 @@
 import hashlib
 import imp
 import json
-import logging
 import os
 import pwd
 import re
@@ -686,7 +685,7 @@ def make_valid_did(lfn_dict):
     return lfn_copy
 
 
-def send_trace(trace, trace_endpoint, user_agent, retries=5, logger=None, log_prefix=''):
+def send_trace(trace, trace_endpoint, user_agent, retries=5):
     """
     Send the given trace to the trace endpoint
 
@@ -694,23 +693,16 @@ def send_trace(trace, trace_endpoint, user_agent, retries=5, logger=None, log_pr
     :param trace_endpoint: the endpoint where the trace should be send
     :param user_agent: the user agent sending the trace
     :param retries: the number of retries if sending fails
-    :param logger: the logger object to put debug output, None means no logging
-    :param log_prefix: a string that will be put in front of each debug msg
     :return: 0 on success, 1 on failure
     """
-    if not logger:
-        logger = logging.getLogger(__name__).getChild('null')
-        logger.disabled = True
     if user_agent.startswith('pilot'):
-        logger.debug('%spilot detected - not sending trace' % log_prefix)
         return 0
-    logger.debug('%ssending trace' % log_prefix)
     for dummy in range(retries):
         try:
             requests.post(trace_endpoint + '/traces/', verify=False, data=json.dumps(trace))
             return 0
-        except Exception as error:
-            logger.debug('%s%s' % (log_prefix, error))
+        except Exception:
+            pass
     return 1
 
 


Test patch: