Skip to content

Commit 339f7f0

Browse files
committed
Create RFC for a logging system and list some required features
1 parent b379b19 commit 339f7f0

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

RFC-0026-logging-system.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# PyTorch Logging System
2+
3+
## **Summary**
4+
Create a new message logging system for PyTorch with the following features:
5+
6+
* The Python and C++ APIs for emitting messages and changing settings should
7+
all be consistent
8+
9+
* Offer different log levels (info, warning, error, ...)
10+
11+
* Offer different classes of messages
12+
13+
- TODO: What are some of the message classes that we'll need?
14+
15+
* Creating new message classes and log levels should be easy
16+
17+
* Settings to turn warnings for a specific message class into errors
18+
19+
* Settings to disable specific message classes and log levels
20+
21+
- TODO: However, I assume most errors should not be disableable
22+
23+
* Settings to avoid emitting duplicate messages generated by multiple
24+
`torch.distribted` ranks (related to issue
25+
[#68768](https://github.com/pytorch/pytorch/issues/68768))
26+
27+
* Ability to make a particular warning class or log level only warn once
28+
29+
- NOTE: Currently `TORCH_WARN_ONCE` does this in C++, but there is no Python
30+
equivalent
31+
32+
- TODO: Should there be a setting to turn a warn-always into a warn-once for
33+
a given message class?
34+
35+
* Settings can be changed from Python, C++, or environment variables
36+
37+
* Should integrate with Meta's internal logging system, which is
38+
[glog](https://github.com/google/glog)
39+
40+
- TODO: What are all the requirements that definine "integrating with glog"
41+
42+
* Must be OSS-friendly, so it shouldn't require libraries (like glog) which may
43+
cause incompatibility issues for projects that use PyTorch
44+
45+
46+
## **Motivation**
47+
Original issue: [link](https://github.com/pytorch/pytorch/issues/72948)
48+
49+
Currently, it is challenging for PyTorch developers to provide messages that
50+
act consistently between Python and C++.
51+
52+
It is also challenging for PyTorch users to manage the messages that PyTorch
53+
emits. For instance, if a PyTorch user happens to be calling PyTorch functions
54+
that emit lots of warnings, it can be difficult for them to filter out those
55+
warnings so that their project's users don't get bombarded with warnings that
56+
they don't need to see.

0 commit comments

Comments
 (0)