Ensure logging is initialized by cyclecloud_provider and remove any reference to jetpack.log
This commit is contained in:
Родитель
47deb4f27c
Коммит
b11fd61070
|
@ -2,8 +2,6 @@ import os
|
|||
import calendar
|
||||
from util import JsonStore, init_logging
|
||||
|
||||
logger = init_logging()
|
||||
|
||||
|
||||
class CapacityTrackingDb:
|
||||
|
||||
|
@ -12,6 +10,9 @@ class CapacityTrackingDb:
|
|||
self.cluster_name = cluster_name
|
||||
self.clock = clock
|
||||
self.limits_timeout = limits_timeout
|
||||
# initialize in constructor so that cyclecloud_provider can initialize this
|
||||
# with the proper log_level. In tests, this will use the default.
|
||||
self.logger = init_logging()
|
||||
|
||||
default_dir = os.getenv('HF_WORKDIR', '/var/tmp')
|
||||
self.db_dir = config.get('symphony.hostfactory.db_path', default_dir)
|
||||
|
|
|
@ -30,6 +30,16 @@ def init_logging(loglevel=logging.INFO, logfile=None):
|
|||
try:
|
||||
import jetpack
|
||||
jetpack.util.setup_logging()
|
||||
root_logger = logging.getLogger()
|
||||
filtered_handlers = []
|
||||
for handler in root_logger.handlers:
|
||||
if hasattr(handler, "baseFilename"):
|
||||
bfn = getattr(handler, "baseFilename")
|
||||
if bfn and bfn.endswith("jetpack.log"):
|
||||
continue
|
||||
filtered_handlers.append(handler)
|
||||
|
||||
root_logger.handlers = filtered_handlers
|
||||
for handler in logging.getLogger().handlers:
|
||||
handler.setLevel(logging.ERROR)
|
||||
except ImportError:
|
||||
|
|
Загрузка…
Ссылка в новой задаче