@@ -89,18 +89,22 @@ sends logging output to a disk file. It inherits the output functionality from
8989:class: `StreamHandler `.
9090
9191
92- .. class :: FileHandler(filename, mode='a', encoding=None, delay=False)
92+ .. class :: FileHandler(filename, mode='a', encoding=None, delay=False, errors=None )
9393
9494 Returns a new instance of the :class: `FileHandler ` class. The specified file is
9595 opened and used as the stream for logging. If *mode * is not specified,
9696 :const: `'a' ` is used. If *encoding * is not ``None ``, it is used to open the file
9797 with that encoding. If *delay * is true, then file opening is deferred until the
98- first call to :meth: `emit `. By default, the file grows indefinitely.
98+ first call to :meth: `emit `. By default, the file grows indefinitely. If
99+ *errors * is specified, it's used to determine how encoding errors are handled.
99100
100101 .. versionchanged :: 3.6
101102 As well as string values, :class: `~pathlib.Path ` objects are also accepted
102103 for the *filename * argument.
103104
105+ .. versionchanged :: 3.9
106+ The *errors * parameter was added.
107+
104108 .. method :: close()
105109
106110 Closes the file.
@@ -168,18 +172,22 @@ exclusive locks - and so there is no need for such a handler. Furthermore,
168172for this value.
169173
170174
171- .. class :: WatchedFileHandler(filename, mode='a', encoding=None, delay=False)
175+ .. class :: WatchedFileHandler(filename, mode='a', encoding=None, delay=False, errors=None )
172176
173177 Returns a new instance of the :class: `WatchedFileHandler ` class. The specified
174178 file is opened and used as the stream for logging. If *mode * is not specified,
175179 :const: `'a' ` is used. If *encoding * is not ``None ``, it is used to open the file
176180 with that encoding. If *delay * is true, then file opening is deferred until the
177- first call to :meth: `emit `. By default, the file grows indefinitely.
181+ first call to :meth: `emit `. By default, the file grows indefinitely. If
182+ *errors * is provided, it determines how encoding errors are handled.
178183
179184 .. versionchanged :: 3.6
180185 As well as string values, :class: `~pathlib.Path ` objects are also accepted
181186 for the *filename * argument.
182187
188+ .. versionchanged :: 3.9
189+ The *errors * parameter was added.
190+
183191 .. method :: reopenIfNeeded()
184192
185193 Checks to see if the file has changed. If it has, the existing stream is
@@ -205,7 +213,7 @@ module, is the base class for the rotating file handlers,
205213not need to instantiate this class, but it has attributes and methods you may
206214need to override.
207215
208- .. class :: BaseRotatingHandler(filename, mode, encoding=None, delay=False)
216+ .. class :: BaseRotatingHandler(filename, mode, encoding=None, delay=False, errors=None )
209217
210218 The parameters are as for :class: `FileHandler `. The attributes are:
211219
@@ -284,13 +292,14 @@ The :class:`RotatingFileHandler` class, located in the :mod:`logging.handlers`
284292module, supports rotation of disk log files.
285293
286294
287- .. class :: RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False)
295+ .. class :: RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None )
288296
289297 Returns a new instance of the :class: `RotatingFileHandler ` class. The specified
290298 file is opened and used as the stream for logging. If *mode * is not specified,
291299 ``'a' `` is used. If *encoding * is not ``None ``, it is used to open the file
292300 with that encoding. If *delay * is true, then file opening is deferred until the
293- first call to :meth: `emit `. By default, the file grows indefinitely.
301+ first call to :meth: `emit `. By default, the file grows indefinitely. If
302+ *errors * is provided, it determines how encoding errors are handled.
294303
295304 You can use the *maxBytes * and *backupCount * values to allow the file to
296305 :dfn: `rollover ` at a predetermined size. When the size is about to be exceeded,
@@ -311,6 +320,9 @@ module, supports rotation of disk log files.
311320 As well as string values, :class: `~pathlib.Path ` objects are also accepted
312321 for the *filename * argument.
313322
323+ .. versionchanged :: 3.9
324+ The *errors * parameter was added.
325+
314326 .. method :: doRollover()
315327
316328 Does a rollover, as described above.
@@ -331,7 +343,7 @@ The :class:`TimedRotatingFileHandler` class, located in the
331343timed intervals.
332344
333345
334- .. class :: TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None)
346+ .. class :: TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None, errors=None )
335347
336348 Returns a new instance of the :class: `TimedRotatingFileHandler ` class. The
337349 specified file is opened and used as the stream for logging. On rotating it also
@@ -391,6 +403,9 @@ timed intervals.
391403 rollover, and subsequent rollovers would be calculated via the normal
392404 interval calculation.
393405
406+ If *errors * is specified, it's used to determine how encoding errors are
407+ handled.
408+
394409 .. note :: Calculation of the initial rollover time is done when the handler
395410 is initialised. Calculation of subsequent rollover times is done only
396411 when rollover occurs, and rollover occurs only when emitting output. If
@@ -411,6 +426,9 @@ timed intervals.
411426 As well as string values, :class: `~pathlib.Path ` objects are also accepted
412427 for the *filename * argument.
413428
429+ .. versionchanged :: 3.9
430+ The *errors * parameter was added.
431+
414432 .. method :: doRollover()
415433
416434 Does a rollover, as described above.
0 commit comments