logging

The logging module provides a flexible facility for applications to log events, errors, warnings, and debugging information. This information can be collected, filtered, written to files, sent to the system log, and even sent over the network to remote machines.

Five different levels of information are collected by the logging module. These levels have both a symbolic name and a numerical value that is used for filtering:

LevelValueDescription
CRITICAL50Critical errors/messages
ERROR40Errors
WARNING30Warning messages
INFO20Informative messages
DEBUG10Debugging
NOTSET0No level set

Basic Logging

In the most simple case, logging messages are issued by an application and sent to a special Logging object known as the root logger. By default, the ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.