generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Currently StandardSupervisor class method _setup_logger has the same issue fixed by #26 #27 where it cannot handle case where log level env variable is specified as an int (read as string).
We want to update this so it can handle this case as well as silently fallback to a specific level (e.g. ERROR) if parse fails.
Lines 116 to 119 in 3a14116
| def _setup_logging(self) -> None: | |
| """Configure logging based on environment.""" | |
| log_level = os.getenv("LOG_LEVEL", "INFO").upper() | |
| self.logger.setLevel(getattr(logging, log_level, logging.INFO)) |
See parse_level:
model-hosting-container-standards/python/model_hosting_container_standards/logging_config.py
Lines 9 to 25 in 3a14116
| def parse_level(level: str) -> Union[int, str]: | |
| """Parse a log level string into a valid logging level. | |
| Args: | |
| level: Log level string to parse. | |
| Returns: | |
| Valid logging level. | |
| """ | |
| # Convert level to uppercase | |
| level = level.upper() | |
| # Convert numeric log level string to int so `setLevel` can recognize it | |
| try: | |
| return int(level) | |
| except ValueError: | |
| return level |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working