## 6.28.1 Logger Objects

Loggers have the following attributes and methods. Note that Loggers are never instantiated directly, but always through the module-level function `logging.getLogger(name)`.

`propagate`
  If this evaluates to false, logging messages are not passed by this logger or by child loggers to higher level (ancestor) loggers. The constructor sets this attribute to 1.

`setLevel`( | lvl)

  Sets the threshold for this logger to lvl. Logging messages which are less severe than lvl will be ignored. When a logger is created, the level is set to `NOTSET` (which causes all messages to be processed in the root logger, or delegation to the parent in non-root loggers).

`isEnabledFor`( | lvl)

  Indicates if a message of severity lvl would be processed by this logger. This method checks first the module-level level set by `logging.disable(lvl)` and then the logger's effective level as determined by `getEffectiveLevel()`.

`getEffectiveLevel`( | )

  Indicates the effective level for this logger. If a value other than `NOTSET` has been set using `setLevel()`, it is returned. Otherwise, the hierarchy is traversed towards the root until a value other than `NOTSET` is found, and that value is returned.

`debug`( | msg[, *args[, **kwargs]])

  Logs a message with level `DEBUG` on this logger. The msg is the message format string, and the args are the arguments which are merged into msg. The only keyword argument in kwargs which is inspected is exc_info which, if it does not evaluate as false, causes exception information (via a call to `sys.exc_info()`) to be added to the logging message.

`info`( | msg[, *args[, **kwargs]])

  Logs a message with level `INFO` on this logger. The arguments are interpreted as for `debug()`.

`warning`( | msg[, *args[, **kwargs]])

  Logs a message with level `WARNING` on this logger. The arguments are interpreted as for `debug()`.

`error`( | msg[, *args[, **kwargs]])

  Logs a message with level `ERROR` on this logger. The arguments are interpreted as for `debug()`.

`critical`( | msg[, *args[, **kwargs]])

  Logs a message with level `CRITICAL` on this logger. The arguments are interpreted as for `debug()`.

`log`( | lvl, msg[, *args[, **kwargs]])

  Logs a message with level lvl on this logger. The other arguments are interpreted as for `debug()`.

`exception`( | msg[, *args])

  Logs a message with level `ERROR` on this logger. The arguments are interpreted as for `debug()`. Exception info is added to the logging message. This method should only be called from an exception handler.

`addFilter`( | filt)

  Adds the specified filter filt to this logger.

`removeFilter`( | filt)

  Removes the specified filter filt from this logger.

`filter`( | record)

  Applies this logger's filters to the record and returns a true value if the record is to be processed.

`addHandler`( | hdlr)

  Adds the specified handler hdlr to this logger.

`removeHandler`( | hdlr)

  Removes the specified handler hdlr from this logger.

`findCaller`( | )

  Finds the caller's source filename and line number. Returns the filename and line number as a 2-element tuple.

`handle`( | record)

  Handles a record by passing it to all handlers associated with this logger and its ancestors (until a false value of propagate is found). This method is used for unpickled records received from a socket, as well as those created locally. Logger-level filtering is applied using `filter()`.

`makeRecord`( | name, lvl, fn, lno, msg, args, exc_info)

  This is a factory method which can be overridden in subclasses to create specialized `LogRecord` instances.