@@ -948,14 +948,14 @@ functions.
948
948
Logs a message with level *level * on the root logger. The other arguments are
949
949
interpreted as for :func: `debug `.
950
950
951
- PLEASE NOTE : The above module-level functions which delegate to the root
952
- logger should *not * be used in threads, in versions of Python earlier than
953
- 2.7.1 and 3.2, unless at least one handler has been added to the root
954
- logger *before * the threads are started. These convenience functions call
955
- :func: `basicConfig ` to ensure that at least one handler is available; in
956
- earlier versions of Python, this can (under rare circumstances) lead to
957
- handlers being added multiple times to the root logger, which can in turn
958
- lead to multiple messages for the same event.
951
+ .. note : : The above module-level functions which delegate to the root
952
+ logger should *not * be used in threads, in versions of Python earlier
953
+ than 2.7.1 and 3.2, unless at least one handler has been added to the
954
+ root logger *before * the threads are started. These convenience functions
955
+ call :func: `basicConfig ` to ensure that at least one handler is
956
+ available; in earlier versions of Python, this can (under rare
957
+ circumstances) lead to handlers being added multiple times to the root
958
+ logger, which can in turn lead to multiple messages for the same event.
959
959
960
960
.. function :: disable(lvl)
961
961
@@ -1011,12 +1011,12 @@ functions.
1011
1011
This function does nothing if the root logger already has handlers
1012
1012
configured for it.
1013
1013
1014
- PLEASE NOTE : This function should be called from the main thread
1015
- before other threads are started. In versions of Python prior to
1016
- 2.7.1 and 3.2, if this function is called from multiple threads,
1017
- it is possible (in rare circumstances) that a handler will be added
1018
- to the root logger more than once, leading to unexpected results
1019
- such as messages being duplicated in the log.
1014
+ .. note : : This function should be called from the main thread
1015
+ before other threads are started. In versions of Python prior to
1016
+ 2.7.1 and 3.2, if this function is called from multiple threads,
1017
+ it is possible (in rare circumstances) that a handler will be added
1018
+ to the root logger more than once, leading to unexpected results
1019
+ such as messages being duplicated in the log.
1020
1020
1021
1021
The following keyword arguments are supported.
1022
1022
@@ -1115,6 +1115,21 @@ functions.
1115
1115
:kwargs: Additional keyword arguments.
1116
1116
1117
1117
1118
+ Module-Level Attributes
1119
+ -----------------------
1120
+
1121
+ .. attribute :: lastResort
1122
+
1123
+ A "handler of last resort" is available through this attribute. This
1124
+ is a :class: `StreamHandler ` writing to ``sys.stderr `` with a level of
1125
+ ``WARNING ``, and is used to handle logging events in the absence of any
1126
+ logging configuration. The end result is to just print the message to
1127
+ ``sys.stderr ``. This replaces the earlier error message saying that
1128
+ "no handlers could be found for logger XYZ". If you need the earlier
1129
+ behaviour for some reason, ``lastResort `` can be set to ``None ``.
1130
+
1131
+ .. versionadded :: 3.2
1132
+
1118
1133
Integration with the warnings module
1119
1134
------------------------------------
1120
1135
0 commit comments