Skip to content

Commit 2779dad

Browse files
Use named logger instead of modifying root logger (#17684)
Replace logging.basicConfig() and logging.info() calls with a named logger (logging.getLogger("ppocr")) in generate_multi_language_configs.py to avoid mutating the Python root logger and overriding user logging configuration. Fixes #17344 Co-authored-by: Lin Manhui <mhlin425@whu.edu.cn>
1 parent 925e2ed commit 2779dad

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

configs/rec/multi_language/generate_multi_language_configs.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import os.path
1818
import logging
1919

20-
logging.basicConfig(level=logging.INFO)
20+
logger = logging.getLogger("ppocr")
2121

2222
support_list = {
2323
"it": "italian",
@@ -281,27 +281,27 @@ def loss_file(path):
281281

282282
with open(save_file_path, "w") as f:
283283
yaml.dump(dict(global_config), f, default_flow_style=False, sort_keys=False)
284-
logging.info("Project path is :{}".format(project_path))
285-
logging.info(
284+
logger.info("Project path is :{}".format(project_path))
285+
logger.info(
286286
"Train list path set to :{}".format(
287287
global_config["Train"]["dataset"]["label_file_list"][0]
288288
)
289289
)
290-
logging.info(
290+
logger.info(
291291
"Eval list path set to :{}".format(
292292
global_config["Eval"]["dataset"]["label_file_list"][0]
293293
)
294294
)
295-
logging.info(
295+
logger.info(
296296
"Dataset root path set to :{}".format(
297297
global_config["Eval"]["dataset"]["data_dir"]
298298
)
299299
)
300-
logging.info(
300+
logger.info(
301301
"Dict path set to :{}".format(
302302
global_config["Global"]["character_dict_path"]
303303
)
304304
)
305-
logging.info(
305+
logger.info(
306306
"Config file set to :configs/rec/multi_language/{}".format(save_file_path)
307307
)

0 commit comments

Comments
 (0)