logging.handlers — Logging handlers — Python 3.14.7 documentation

docs.python.org

Tin mới

logging.config — Logging configuration

platform — Access to underlying platform’s identifying data

Python Module Index

3.14.7 Documentation

The Python Standard Library

Generic Operating System Services

logging: Flexible event logging system for applications.

This page contains only reference information. For tutorials, please see

traceback.print_exception()

If a formatter is specified, it is used to format the record. The record is then written to the stream followed by terminator. If exception information is present, it is formatted using traceback.print_exception() and ap

Configuring Logging for a Library

The NullHandler class, located in the core logging package, does not do any formatting or output. It is essentially a ‘no-op’ handler for use by library developers.

WatchedFileHandler¶

The WatchedFileHandler class, located in the logging.handlers module, is a FileHandler which watches the file it is logging to. If the file changes, it is closed and reopened using the file name.

Using a rotator and namer to customize log rotation processing

The BaseRotatingHandler class, located in the logging.handlers module, is the base class for the rotating file handlers, RotatingFileHandler and TimedRotatingFileHandler. You should not need to instantiate this class, bu

socket.SOCK_STREAM

This is a factory method which allows subclasses to define the precise type of socket they want. The default implementation creates a TCP socket (socket.SOCK_STREAM).

smtplib.SMTP.starttls()

To specify the use of a secure protocol (TLS), pass in a tuple to the secure argument. This will only be used when authentication credentials are supplied. The tuple should be either an empty tuple, or a single-value tup

urllib.parse.urlencode()

Since preparing a record for sending it to a web server is not the same as a generic formatting operation, using setFormatter() to specify a Formatter for a HTTPHandler has no effect. Instead of calling format(), this ha

queue: A synchronized queue class.

The QueueHandler class, located in the logging.handlers module, supports sending logging messages to a queue, such as those implemented in the queue or multiprocessing modules.

multiprocessing: Process-based parallelism.

The QueueHandler class, located in the logging.handlers module, supports sending logging messages to a queue, such as those implemented in the queue or multiprocessing modules.

contextmanager.__enter__

Changed in version 3.14: QueueListener can now be used as a context manager via with. When entering the context, the listener is started. When exiting the context, the listener is stopped. __enter__() returns the QueueLi