-yardstick_utils.makedirs(constants.YARDSTICK_LOG_DIR)
-LOG_FILE = os.path.join(constants.YARDSTICK_LOG_DIR, 'yardstick.log')
-LOG_FORMATTER = ('%(asctime)s '
- '%(name)s %(filename)s:%(lineno)d '
- '%(levelname)s %(message)s')
+try:
+ # do not use yardstick.common.utils.makedirs
+ # since yardstick.common.utils creates a logger
+ # and so it cannot be imported before this code
+ os.makedirs(constants.LOG_DIR)
+except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+
+LOG_FILE = os.path.join(constants.LOG_DIR, 'yardstick.log')
+LOG_FORMATTER = '%(asctime)s [%(levelname)s] %(name)s %(filename)s:%(lineno)d %(message)s'