Skip to content

Cannot maintain effective debug-level on distributed (parent) logger with local scheduler/cluster #2660

Open

Description

@javabrett

With config.yaml including simple-form logging config:

logging:
  distributed: debug

>>> import logging
>>> import distributed
>>> logging.getLogger("distributed")
<Logger distributed (DEBUG)>
>>> logging.getLogger("distributed").handlers
[<StreamHandler <stderr> (NOTSET)>]
>>> logging.getLogger("distributed").debug("debug")
distributed - DEBUG - debug
>>> 

All looks good. Start a Client:

>>> from distributed import Client
>>> c = Client()
>>> logging.getLogger("distributed")
<Logger distributed (DEBUG)>
>>> logging.getLogger("distributed").handlers
[<StreamHandler <stderr> (WARNING)>]
>>> logging.getLogger("distributed").debug("debug")
>>> 

No logging output, as the distributed logger has had its Handler (a StreamHandler) set to WARNING threshold.

Once a Client is started and fires-up a local cluster/scheduler, I suspect a worker:

if silence_logs:
silence_logging(level=silence_logs)

... runs silence_logging, which does just as it is named:

def silence_logging(level, root="distributed"):
"""
Change all StreamHandlers for the given logger to the given level
"""
if isinstance(level, str):
level = getattr(logging, level.upper())
old = None
logger = logging.getLogger(root)
for handler in logger.handlers:
if isinstance(handler, logging.StreamHandler):
old = handler.level
handler.setLevel(level)
return old

See also #2659 . It might be argued that nothing important is logging to the distributed logger, and everything is logging to a child e.g. distributed.client (even through the loggers are flattened with the simple config), which might be true, but it further erodes the notion of hierarchical logging.

Activity

  1. mrocklin commented on May 6, 2019

    @mrocklin
    Member

    @jcrist might have thoughts here

  2. GenevieveBuckley commented on Oct 19, 2021

    @GenevieveBuckley
    Contributor

    Cross referencing this broader discussion on logging: #2659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions