Remove unhelpful log message in copy middleware

We probably don't need an extra INFO-level message every time a user
makes a PUT request with X-Copy-From set. It's still in the proxy's
access logs.

Change-Id: I32ce8ff16cb296dd5acef07202a59bc5125111c1
This commit is contained in:
Samuel Merritt 2018-05-29 16:59:14 -07:00
parent e7e016267c
commit 553bef0d1d
2 changed files with 5 additions and 10 deletions

View File

@ -361,10 +361,6 @@ class ServerSideCopyMiddleware(object):
source_path = '/%s/%s/%s/%s' % (ver, src_account_name, source_path = '/%s/%s/%s/%s' % (ver, src_account_name,
src_container_name, src_obj_name) src_container_name, src_obj_name)
if req.environ.get('swift.orig_req_method', req.method) != 'POST':
self.logger.info("Copying object from %s to %s" %
(source_path, req.path))
# GET the source object, bail out on error # GET the source object, bail out on error
ssc_ctx = ServerSideCopyWebContext(self.app, self.logger) ssc_ctx = ServerSideCopyWebContext(self.app, self.logger)
source_resp = self._get_source_object(ssc_ctx, source_path, req) source_resp = self._get_source_object(ssc_ctx, source_path, req)

View File

@ -98,17 +98,16 @@ class TestSubRequestLogging(unittest.TestCase):
req.get_response(app) req.get_response(app)
info_log_lines = app.fake_logger.get_lines_for_level('info') info_log_lines = app.fake_logger.get_lines_for_level('info')
self.assertEqual(len(info_log_lines), 5) self.assertEqual(len(info_log_lines), 4)
self.assertTrue(info_log_lines[0].startswith('Copying object'))
subreq_get = '%s %s' % (subrequest_type, SUB_GET_PATH) subreq_get = '%s %s' % (subrequest_type, SUB_GET_PATH)
subreq_put = '%s %s' % (subrequest_type, SUB_PUT_POST_PATH) subreq_put = '%s %s' % (subrequest_type, SUB_PUT_POST_PATH)
origput = 'PUT %s' % self.path origput = 'PUT %s' % self.path
copyget = 'GET %s' % '/v1/a/test/obj' copyget = 'GET %s' % '/v1/a/test/obj'
# expect GET subreq, copy GET, PUT subreq, orig PUT # expect GET subreq, copy GET, PUT subreq, orig PUT
self.assertTrue(subreq_get in info_log_lines[1]) self.assertTrue(subreq_get in info_log_lines[0])
self.assertTrue(copyget in info_log_lines[2]) self.assertTrue(copyget in info_log_lines[1])
self.assertTrue(subreq_put in info_log_lines[3]) self.assertTrue(subreq_put in info_log_lines[2])
self.assertTrue(origput in info_log_lines[4]) self.assertTrue(origput in info_log_lines[3])
def test_subrequest_logged_x_copy_from(self): def test_subrequest_logged_x_copy_from(self):
self._test_subrequest_logged('HEAD') self._test_subrequest_logged('HEAD')