Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't toggle torch logger to NOTSET if it is not set; always use pre-existing #113842

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions torch/_logging/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def clear(self):

def set_logs(
*,
all: int = DEFAULT_LOG_LEVEL,
all: Optional[int] = None,
dynamo: Optional[int] = None,
aot: Optional[int] = None,
dynamic: Optional[int] = None,
Expand Down Expand Up @@ -759,12 +759,15 @@ def _init_logs(log_file_name=None):
# First, reset all known (registered) loggers to NOTSET, so that they
# respect their parent log level
for log_qname in log_registry.get_log_qnames():
# But not the top level torch level: this defaults to WARNING so
# that our log messages don't leak to the lower levels
if log_qname == "torch":
continue
log = logging.getLogger(log_qname)
log.setLevel(logging.NOTSET)

# Now, for all loggers which the user requested to have non-standard
# logging behavior (and torch, because we always toggle torch), modify
# their log levels
# logging behavior, modify their log levels
for log_qname, level in log_state.get_log_level_pairs():
log = logging.getLogger(log_qname)
log.setLevel(level)
Expand Down