O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required