Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
261618f4
Unverified
Commit
261618f4
authored
Jul 20, 2021
by
Qizhu Li
Committed by
GitHub
Jul 20, 2021
Browse files
Resolves the duplicate logs issue (#1164)
parent
74626ece
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
mmcv/utils/logging.py
mmcv/utils/logging.py
+11
-0
No files found.
mmcv/utils/logging.py
View file @
261618f4
...
...
@@ -37,6 +37,17 @@ def get_logger(name, log_file=None, log_level=logging.INFO, file_mode='w'):
if
name
.
startswith
(
logger_name
):
return
logger
# handle duplicate logs to the console
# Starting in 1.8.0, PyTorch DDP attaches a StreamHandler <stderr> (NOTSET)
# to the root logger. As logger.propagate is True by default, this root
# level handler causes logging messages from rank>0 processes to
# unexpectedly show up on the console, creating much unwanted clutter.
# To fix this issue, we set the root logger's StreamHandler, if any, to log
# at the ERROR level.
for
handler
in
logger
.
root
.
handlers
:
if
type
(
handler
)
is
logging
.
StreamHandler
:
handler
.
setLevel
(
logging
.
ERROR
)
stream_handler
=
logging
.
StreamHandler
()
handlers
=
[
stream_handler
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment