Change the future

Sunday 1:50 p.m.–2:20 p.m.

Become a logging expert in 30 minutes

Gavin M. Roy

Audience level:
Core Python (Language, Stdlib)


The logging module is one of the more complex areas of the Python standard library. In this talk you will learn how to leverage loggers, formatters, handlers and filters. In addition you will learn how to use dictConfig and other formats to manage logging settings for your applications.


If used correctly, the logging module is a great tool for gathering information about the runtime state of your application. For example, when an application is under development or experiencing problems, the DEBUG level is extremely useful if leveraged, but normally can be information overload. In this talk I will demonstrate how an application can provide multiple levels of instrumentation with logging and deliver the data via different channels such as syslog, automatically rotating log files or over other protocols such as AMQP.


  • Brief Introduction to Logging # 5 minutes
    • Debugging applications with and without logging (ie using print)
    • The performance impact of logging
    • Cool features in the logging module
  • The logging lexicon # 5 minutes
    • Loggers, Handlers, Formatters, Filters
    • How to create and use:
      • a Logger
      • a Handler
      • a Formatter
      • a Filter
  • Leveraging the handler objects # 10 minutes
  • Using the Stream, SMTP, Socket, Datagram, Memory and HTTP Handlers
  • Configuration via logging.config # 5 minutes
  • Writing a custom AMQP handler # 5 minutes