microsoft / microsoft/FLAML

logging issue

Open
#955 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
4.4k
Forks
565
Avg merge
5d 8m
Merged PRs (30d)
17

Description

The current logger in different files doesn't work as expected. In the `automl.py`, it imports logger from `flaml.automl.logger` which names `flaml.automl.logger`, the logging info is thus like `[flaml.automl.logger: 03-17 18:29:12] {1771} INFO - task = regression`, but it would be better to be `[flaml.automl.automl: 03-17 18:29:12] {1771} INFO - task = regression` which indicates the log message is generated in `flaml.automl.automl` module.

Other loggers in many different files are initiated with `logger = logging.getLogger(__name__)`, the problem is that we can't pass the user setted verbose into many of the files, thus we can't control the logging level in these files. The result is that the debug and info messages will never be printed as the default log level is warning.

One solution could be that we initate two loggers, one is for automl, another is for tune in the `__init__.py` of flaml root path, as we want to have different logging levels for automl and tune. All the other files import the logger based on they're for automl or tune. Thus all the automl modules will have the same logger, while all the tune modules will use another logger. This solves the issue of logger level.

To solve the logger name issue, we can pass `extra` param while logging. For instance, `logger.info('task = regression', extra={'name': __name__})` will print `[flaml.automl.logger: 03-17 18:29:12] {1771} INFO - task = regression` if the code is in `flaml/automl/logger.py`, and it will print `[flaml.tune.tune: 03-17 18:29:12] {1771} INFO - task = regression` if the code is in `flaml/tune/tune.py`.

What do you think? @sonichi

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.