Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid using fileConfig to init logging, as it overwrites root logger #978

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions src/rez/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import print_function

from rez.utils._version import _rez_version
import logging.config
import atexit
import sys
import os


Expand All @@ -14,10 +14,30 @@
module_root_path = __path__[0]


logging_conf_file = os.environ.get(
'REZ_LOGGING_CONF',
os.path.join(module_root_path, 'utils', 'logging.conf'))
logging.config.fileConfig(logging_conf_file, disable_existing_loggers=False)
# TODO: Revamp logging. For now, this is here for backwards compatibility
def _init_logging():
logging_conf = os.getenv("REZ_LOGGING_CONF")
if logging_conf:
import logging.config
logging.config.fileConfig(logging_conf, disable_existing_loggers=False)
return

import logging
from rez.utils.colorize import ColorizedStreamHandler

formatter = logging.Formatter(
fmt="%(asctime)s %(levelname)-8s %(message)s",
datefmt="%X"
)
handler = ColorizedStreamHandler(sys.stderr)
handler.setFormatter(formatter)
logger = logging.getLogger("rez")
logger.propagate = False
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)


_init_logging()


# actions registered on SIGUSR1
Expand Down
2 changes: 1 addition & 1 deletion src/rez/utils/_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


# Update this value to version up Rez. Do not place anything else in this file.
_rez_version = "2.69.5"
_rez_version = "2.69.6"


# Copyright 2013-2016 Allan Johns.
Expand Down
26 changes: 0 additions & 26 deletions src/rez/utils/logging.conf

This file was deleted.