This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: NullHandler init refusing arguments
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Romuald, vinay.sajip
Priority: normal Keywords: patch

Created on 2018-08-01 13:34 by Romuald, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8605 closed Romuald, 2018-08-01 13:45
Messages (2)
msg322861 - (view) Author: Romuald Brunet (Romuald) * Date: 2018-08-01 13:34

I'm using a custom Handler that relies on a third-party library that may not be present

  from acme.logging import CustomHandler as BaseHandler
except ImportError:
  import logging.NullHandler as BaseHandler

class MoreCustomHandler(BaseHandler):
  def handle(self):

The logging configuration has some arguments for the CustomHandler. The problem is that the NullHandler does not accept them.

I expected it to be a "dummy" handler that might accept any argument
msg322878 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2018-08-01 17:50
> I expected it to be a "dummy" handler that might accept any argument

I don't know why you expected that, but your expectation wasn't valid. You will need to define your own BaseHandler which handles any arguments passed by your logging configuration.

NullHandler's __init__ is inherited from logging.Handler. There are no plans to change that. The documentation for it states:

"The NullHandler class, located in the core logging package, does not do any formatting or output. It is essentially a ‘no-op’ handler for use by library developers."

This does not indicate that it is suitable for use as a base class. If you want to use a base class for your handler, use logging.Handler.
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78488
2018-08-01 17:50:25vinay.sajipsetstatus: open -> closed
resolution: rejected
messages: + msg322878

stage: patch review -> resolved
2018-08-01 13:53:14berker.peksagsetnosy: + vinay.sajip
2018-08-01 13:45:22Romualdsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8111
2018-08-01 13:34:15Romualdcreate