pythonpython-3.xlogginghttphandler

HTTPHandler class initialization parameters consist redundant information


From the official docs on the HTTPHandler class:

class logging.handlers.HTTPHandler(host, url, method='GET', secure=False, credentials=None, context=None)

Returns a new instance of the HTTPHandler class. The host can be of the form host:port, should you need to use a specific port number.

There is no documentation of the url parameter, and I'm not quite sure what to put there.

For example, if I have a server listening on http://localhost:8080, then I think I should set:

But wouldn't that always be redundant information?

Or else, what should I set the url parameter to?


Solution

  • You only need to add the path, like:

    host='localhost:8080'
    path='/'
    handler = logging.handlers.HTTPHandler(host, path)