Open any application log and you'll see the same kind of message tagged with different labels: DEBUG, INFO, WARNING, ERROR. Why not just write down everything that happens, in one uniform stream? This post looks at what log levels actually do, and at the companion problem every long-running app eventually faces: keeping a log file from growing forever (rotation).

A Log Level Is a Filtering Threshold

Note: logging means recording what happened while a program runs, so it can be reviewed later in a file or on screen.

Python's standard logging module defines five levels:

Level