Make sure SLO's bulk-delete logger is configured
The SLO middleware supports deletion of an object and all its segments; internally, it uses the same code as the bulk middleware to do this (swift.common.middleware.bulk.Bulk). If something goes wrong in the bulk delete, the Bulk object logs the exception; however, SLO's Bulk object's logger always has the default logging config, so if you've got a non-default logging setup (e.g. syslog to a remote log host), this one exception message goes somewhere else (e.g. local syslog). This patch makes SLO and its bulk deleter share a logger so all the messages go to the same place. Change-Id: Idb01b5640257a02dbb9c698851a14ad8fba11a2d
This commit is contained in:
parent
0018f19524
commit
a8ba751370
@ -188,9 +188,9 @@ class Bulk(object):
|
||||
def __init__(self, app, conf, max_containers_per_extraction=10000,
|
||||
max_failed_extractions=1000, max_deletes_per_request=10000,
|
||||
max_failed_deletes=1000, yield_frequency=60, retry_count=0,
|
||||
retry_interval=1.5):
|
||||
retry_interval=1.5, logger=None):
|
||||
self.app = app
|
||||
self.logger = get_logger(conf, log_route='bulk')
|
||||
self.logger = logger or get_logger(conf, log_route='bulk')
|
||||
self.max_containers = max_containers_per_extraction
|
||||
self.max_failed_extractions = max_failed_extractions
|
||||
self.max_failed_deletes = max_failed_deletes
|
||||
|
@ -594,7 +594,7 @@ class StaticLargeObject(object):
|
||||
'rate_limit_after_segment', '10'))
|
||||
self.rate_limit_segments_per_sec = int(self.conf.get(
|
||||
'rate_limit_segments_per_sec', '0'))
|
||||
self.bulk_deleter = Bulk(app, {})
|
||||
self.bulk_deleter = Bulk(app, {}, logger=self.logger)
|
||||
|
||||
def handle_multipart_get_or_head(self, req, start_response):
|
||||
"""
|
||||
|
@ -1268,6 +1268,12 @@ class TestSloGetManifest(SloTestCase):
|
||||
('GET', '/v1/AUTH_test/gettest/c_15')])
|
||||
|
||||
|
||||
class TestSloBulkLogger(unittest.TestCase):
|
||||
def test_reused_logger(self):
|
||||
slo_mware = slo.filter_factory({})('fake app')
|
||||
self.assertTrue(slo_mware.logger is slo_mware.bulk_deleter.logger)
|
||||
|
||||
|
||||
class TestSloCopyHook(SloTestCase):
|
||||
def setUp(self):
|
||||
super(TestSloCopyHook, self).setUp()
|
||||
|
Loading…
Reference in New Issue
Block a user