-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Description
Asking here primarily to see if you know an obvious reason why this is happening:
I'm sometimes getting a double logging output in my log:
1-19 14:26:36 DEBUG First dates from partial predictions: {'transfer_rates': datetime.date(2020, 10, 5), 'orders_day': datetime.date(2020, 10, 5), 'units_order': datetime.date(2020, 10, 5)}
11-19 14:26:36 DEBUG First date of joint prediction: 2020-10-05
11-19 14:26:36 DEBUG Days predicted in partial predictions fron joint first date: {'transfer_rates': 42, 'orders_day': 42, 'units_order': 42}
11-19 14:26:36 DEBUG Last date of joint prediction: 2020-11-15
11-19 14:26:38 DEBUG Using expected new [[ 850. 1200. 1200. 1200. 3000. 3000. 3000.]]
11-19 14:26:38 DEBUG Using expected winback [[2400. 2600. 2600. 2500. 3000. 3000. 3200.]]
11-19 14:26:38 DEBUG Added noise to expected new and winback
11-19 14:26:38 DEBUG Normalize ranges and draws on prediction for transfer_rates
DEBUG:main:Normalize ranges and draws on prediction for transfer_rates
11-19 14:26:38 DEBUG Normalize ranges and draws on prediction for orders_day
DEBUG:main:Normalize ranges and draws on prediction for orders_day
11-19 14:26:38 DEBUG Normalize ranges and draws on prediction for units_order
DEBUG:main:Normalize ranges and draws on prediction for units_order
11-19 14:26:38 INFO Add adjustments
INFO:main:Add adjustmentsThe white lines containing :main: are the lines I do not expect. Once these lines start appearing, the double logs appear with every single logging statement.
We import a logger in our scripts that is defined as:
def make_logger(console=True):
logger = logging.getLogger(name)
logger.setLevel(level)
if console:
color_fmt = "%(log_color)s" if use_color and console else ""
# some additional unrelated code here, removed for clarity
# set logger stream variable so color only in interactive
# terminals AND notebooks, preventing ANSI escape signatures
# in grayscale log files
stream = None if is_in_ipython_session() else sys.stderr
formatter = colorlog.ColoredFormatter(
fmt=color_fmt + log_format_for_console,
datefmt=time_format_for_console,
log_colors={
"DEBUG": "blue",
"INFO": "green",
"WARNING": "yellow",
"ERROR": "red",
"CRITICAL": "bold_red,bg_white",
},
stream=stream,
)
if log_in_gmt:
formatter.converter = time.gmtime
handler = colorlog.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)I've use this as logger = make_logger(), and then e.g. logger.debug(...). I've noticed that I can trigger the double line behaviour if I accidentally call logging.debug instead of logger.debug, but that is not the case in the above.
Do you have any idea what's going on?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
