# Logging
{id: logging}

## Simple logging
{id: simple-logging}
{i: logging}
{i: basicConfig}

![](examples/logging/simple_logging.py)
![](examples/logging/simple_logging.out)

* Written on STDERR

## Simple logging - set level
{id: simple-logging-set-level}

![](examples/logging/simple_logging_set_level.py)
![](examples/logging/simple_logging_set_level.out)

## Simple logging to a file
{id: simple-logging-to-a-file}

![](examples/logging/simple_logging_to_file.py)

## Simple logging format
{id: simple-logging-format}

![](examples/logging/simple_logging_format.py)

## Simple logging change date format
{id: simple-logging-change-date-format}

![](examples/logging/simple_logging_date_format.py)
![](examples/logging/simple_logging_date_format.out)

## getLogger
{id: getlogger}
{i: getLogger}
{i: FileHandler}
{i: StreamHandler}

![](examples/logging/log.py)

## Time-based logrotation
{id: time-based-logrotation}
{i: TimedRotatingFileHandler}

![](examples/logging/timerotating_log.py)

* S - seconds
* M - minutes
* H - hours
* D - days
* [docs](https://docs.python.org/library/logging.handlers.html#logging.handlers.TimedRotatingFileHandler)

## Size-based logrotation
{id: size-based-logrotation}

![](examples/logging/size_based_rotating_log.py)
