Skip to content

Commit

Permalink
5959 uses logging config at module level (#5960)
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Li <wenqil@nvidia.com>

Fixes #5959

### Description
avoid modifying the system logging config

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
  • Loading branch information
wyli authored Feb 8, 2023
1 parent cdac033 commit 82cd668
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions monai/fl/client/monai_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import logging
import os
import sys
from collections.abc import Mapping, MutableMapping
from typing import Any, cast

Expand All @@ -22,6 +21,7 @@

import monai
from monai.apps.auto3dseg.data_analyzer import DataAnalyzer
from monai.apps.utils import get_logger
from monai.auto3dseg import SegSummarizer
from monai.bundle import DEFAULT_EXP_MGMT_SETTINGS, ConfigComponent, ConfigItem, ConfigParser, patch_bundle_tracking
from monai.engines import SupervisedTrainer, Trainer
Expand All @@ -41,7 +41,7 @@
from monai.utils import min_version, require_pkg
from monai.utils.enums import DataStatsKeys

logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(asctime)s - %(message)s")
logger = get_logger(__name__)


def convert_global_weights(global_weights: Mapping, local_var_dict: MutableMapping) -> tuple[MutableMapping, int]:
Expand Down Expand Up @@ -116,7 +116,7 @@ def __init__(
data_stats_transform_list: list | None = None,
histogram_only: bool = False,
):
self.logger = logging.getLogger(self.__class__.__name__)
self.logger = logger
self.bundle_root = bundle_root
self.config_train_filename = config_train_filename
self.config_filters_filename = config_filters_filename
Expand Down Expand Up @@ -405,7 +405,7 @@ def __init__(
data_stats_transform_list: list | None = None,
tracking: str | dict | None = None,
):
self.logger = logging.getLogger(self.__class__.__name__)
self.logger = logger
if config_evaluate_filename == "default":
# by default, evaluator needs both training and evaluate to be instantiated.
config_evaluate_filename = ["configs/train.json", "configs/evaluate.json"]
Expand Down

0 comments on commit 82cd668

Please sign in to comment.