Creating audit and security logs

Audit and security logs are often duplicated between two handlers: the main control handler and a file handler that is used for audit and security reviews. This means that we'll do the following things:

  • Define additional loggers for audit and security
  • Define multiple handlers for these loggers
  • Optionally, define additional formats for the audit handler

As shown previously, we'll often create separate hierarchies of the audit and security logs. Creating separate hierarchies of loggers is considerably simpler than trying to introduce audit or security via a new logging level. Adding new levels is challenging because the messages are essentially INFO messages; they don't belong on the WARNING side of INFO

Get Mastering Object-Oriented Python - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.