slightly more consistant stats process log names

Also a quick fix to the auditor tests xattr mock
This commit is contained in:
Clay Gerrard 2011-02-10 11:57:51 -06:00
parent 1c939ad8c9
commit 8193e517af
5 changed files with 8 additions and 11 deletions

View File

@ -23,4 +23,4 @@ if __name__ == '__main__':
# currently AccountStat only supports run_once
options['once'] = True
run_daemon(AccountStat, conf_file, section_name='log-processor-stats',
**options)
log_name="account-stats", **options)

View File

@ -34,7 +34,7 @@ if __name__ == '__main__':
uploader_conf.update(plugin_conf)
# pre-configure logger
logger = utils.get_logger(uploader_conf, plugin, log_route='log-uploader',
logger = utils.get_logger(uploader_conf, log_route='log-uploader',
log_to_console=options.get('verbose', False))
# currently LogUploader only supports run_once
options['once'] = True

View File

@ -26,11 +26,7 @@ class CatchErrorMiddleware(object):
def __init__(self, app, conf):
self.app = app
# if the application already has a logger we should use that one
self.logger = getattr(app, 'logger', None)
if not self.logger:
# and only call get_logger if we have to
self.logger = get_logger(conf, log_route='catch-errors')
self.logger = get_logger(conf, log_route='catch-errors')
def __call__(self, env, start_response):
try:

View File

@ -64,9 +64,9 @@ class LogUploader(Daemon):
self.container_name = container_name
self.filename_format = source_filename_format
self.internal_proxy = InternalProxy(proxy_server_conf)
log_name = 'swift-log-uploader-%s' % plugin_name
self.logger = \
utils.get_logger(uploader_conf, plugin_name, log_route=plugin_name)
log_name = '%s-log-uploader' % plugin_name
self.logger = utils.get_logger(uploader_conf, log_name,
log_route=plugin_name)
def run_once(self):
self.logger.info(_("Uploading logs"))

View File

@ -14,7 +14,7 @@
# limitations under the License.
# TODO: Tests
from test import unit as _setup_mocks
from test import unit
import unittest
import tempfile
import os
@ -57,6 +57,7 @@ class TestAuditor(unittest.TestCase):
def tearDown(self):
rmtree(os.path.dirname(self.testdir), ignore_errors=1)
unit.xattr_data = {}
def test_object_audit_extra_data(self):
self.auditor = auditor.ObjectAuditor(self.conf)