File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -178,10 +178,11 @@ following example::
178
178
raise ValueError('Invalid log level: %s' % loglevel)
179
179
logging.basicConfig(level=numeric_level, ...)
180
180
181
- The call to :func: `basicConfig ` should come *before * any calls to :func: `debug `,
182
- :func: `info ` etc. As it's intended as a one-off simple configuration facility,
183
- only the first call will actually do anything: subsequent calls are effectively
184
- no-ops.
181
+ The call to :func: `basicConfig ` should come *before * any calls to
182
+ :func: `debug `, :func: `info `, etc. Otherwise, those functions will call
183
+ :func: `basicConfig ` for you with the default options. As it's intended as a
184
+ one-off simple configuration facility, only the first call will actually do
185
+ anything: subsequent calls are effectively no-ops.
185
186
186
187
If you run the above script several times, the messages from successive runs
187
188
are appended to the file *example.log *. If you want each run to start afresh,
Original file line number Diff line number Diff line change @@ -242,6 +242,10 @@ is the module's name in the Python package namespace.
242
242
above example). In such circumstances, it is likely that specialized
243
243
:class: `Formatter `\ s would be used with particular :class: `Handler `\ s.
244
244
245
+ If no handler is attached to this logger (or any of its ancestors,
246
+ taking into account the relevant :attr: `Logger.propagate ` attributes),
247
+ the message will be sent to the handler set on :attr: `lastResort `.
248
+
245
249
.. versionchanged :: 3.2
246
250
The *stack_info * parameter was added.
247
251
@@ -1038,6 +1042,10 @@ functions.
1038
1042
above example). In such circumstances, it is likely that specialized
1039
1043
:class: `Formatter `\ s would be used with particular :class: `Handler `\ s.
1040
1044
1045
+ This function (as well as :func: `info `, :func: `warning `, :func: `error ` and
1046
+ :func: `critical `) will call :func: `basicConfig ` if the root logger doesn't
1047
+ have any handler attached.
1048
+
1041
1049
.. versionchanged :: 3.2
1042
1050
The *stack_info * parameter was added.
1043
1051
You can’t perform that action at this time.
0 commit comments