Skip to content

Commit 4f1e7bd

Browse files
authored
Arm backend: Configure logging at runtime in aot_arm_compiler (#17485)
Move logging setup out of module import and into `get_args()`, and always apply it with `force=True`. This prevents prior imports from locking the root logger at a different level. Signed-off-by: Martin Lindström <Martin.Lindstroem@arm.com>
1 parent adf975c commit 4f1e7bd

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

examples/arm/aot_arm_compiler.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@
7373
from ..models.model_factory import EagerModelFactory
7474

7575

76-
FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s"
77-
logging.basicConfig(level=logging.WARNING, format=FORMAT)
78-
7976
_arm_model_evaluator = None
8077

8178

@@ -636,8 +633,9 @@ def get_args():
636633
"--evaluate requires --quantize, --intermediates and --delegate to be enabled."
637634
)
638635

639-
if args.debug:
640-
logging.basicConfig(level=logging.DEBUG, format=FORMAT, force=True)
636+
LOGGING_FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s"
637+
logging_level = logging.DEBUG if args.debug else logging.WARNING
638+
logging.basicConfig(level=logging_level, format=LOGGING_FORMAT, force=True)
641639

642640
# if we have custom ops, register them before processing the model
643641
if args.so_library is not None:

0 commit comments

Comments
 (0)