Merge "Make the length of a line logged configurable"
This commit is contained in:
commit
b4c5d6b6c0
@ -135,6 +135,10 @@ use = egg:swift#recon
|
|||||||
#
|
#
|
||||||
# ring_check_interval = 15
|
# ring_check_interval = 15
|
||||||
# recon_cache_path = /var/cache/swift
|
# recon_cache_path = /var/cache/swift
|
||||||
|
#
|
||||||
|
# limits how long rsync error log lines are
|
||||||
|
# 0 means to log the entire line
|
||||||
|
# rsync_error_log_line_length = 0
|
||||||
|
|
||||||
[object-updater]
|
[object-updater]
|
||||||
# You can override the default log routing for this app here (don't use set!):
|
# You can override the default log routing for this app here (don't use set!):
|
||||||
|
@ -81,6 +81,8 @@ class ObjectReplicator(Daemon):
|
|||||||
self.headers = {
|
self.headers = {
|
||||||
'Content-Length': '0',
|
'Content-Length': '0',
|
||||||
'user-agent': 'obj-replicator %s' % os.getpid()}
|
'user-agent': 'obj-replicator %s' % os.getpid()}
|
||||||
|
self.rsync_error_log_line_length = \
|
||||||
|
int(conf.get('rsync_error_log_line_length', 0))
|
||||||
|
|
||||||
def _rsync(self, args):
|
def _rsync(self, args):
|
||||||
"""
|
"""
|
||||||
@ -112,8 +114,11 @@ class ObjectReplicator(Daemon):
|
|||||||
else:
|
else:
|
||||||
self.logger.error(result)
|
self.logger.error(result)
|
||||||
if ret_val:
|
if ret_val:
|
||||||
self.logger.error(_('Bad rsync return code: %(ret)d <- %(args)s'),
|
error_line = _('Bad rsync return code: %(ret)d <- %(args)s') % \
|
||||||
{'args': str(args), 'ret': ret_val})
|
{'args': str(args), 'ret': ret_val}
|
||||||
|
if self.rsync_error_log_line_length:
|
||||||
|
error_line = error_line[:self.rsync_error_log_line_length]
|
||||||
|
self.logger.error(error_line)
|
||||||
elif results:
|
elif results:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_("Successful rsync of %(src)s at %(dst)s (%(time).03f)"),
|
_("Successful rsync of %(src)s at %(dst)s (%(time).03f)"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user