You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, when importing qtm_rt (qtm_rt/__innit__.py) it is affecting the root logger rather than the expected "qtm_rt" logger.
This therefore causes all subsequent logging calls from my program to duplicate output.
Considering you are calling LOG = logging.getLogger("qtm_rt"), I dont think this was intended behaviour.
The following will correct the code to the expected behaviour:
LOG=logging.getLogger("qtm_rt")
LOG_LEVEL=os.getenv("QTM_LOGGING", "DEBUG")
# WIP - sanity check LOG_LEVEL?# As of Python 3.2 you can use the string rather than level numeric value (i.e. DEBUG = 10)# Configure qtm_rt loggerLOG.setLevel(LOG_LEVEL)
# Console handler with custom formatterLOG_CONSOLE_HANDLER=logging.StreamHandler()
LOG_CONSOLE_HANDLER.setLevel(LOG_LEVEL)
LOG_CONSOLE_HANDLER.setFormatter(logging.Formatter("%(asctime)s\t%(levelno)s %(levelname)s\t%(filename)s\t%(funcName)s\t%(message)s"))
LOG.addHandler(LOG_CONSOLE_HANDLER)
And then in my program I can do the following. The below might be worth mentioning on the front page of the docs.
# Set QTM logging level to ERROR before importingos.environ["QTM_LOGGING"] ="ERROR"importqtm_rt
The text was updated successfully, but these errors were encountered:
Hello, when importing qtm_rt (
qtm_rt/__innit__.py
) it is affecting the root logger rather than the expected "qtm_rt" logger.This therefore causes all subsequent logging calls from my program to duplicate output.
The following lines are the cause:
Considering you are calling
LOG = logging.getLogger("qtm_rt")
, I dont think this was intended behaviour.The following will correct the code to the expected behaviour:
And then in my program I can do the following. The below might be worth mentioning on the front page of the docs.
The text was updated successfully, but these errors were encountered: