Skip to content

Judoscale interfering with logging configuration #94

@shughes-uk

Description

@shughes-uk

The judoscale Config.update method seems to call this method

    def _prepare_logging(self):
        log_level = logging.getLevelName(self["LOG_LEVEL"].upper())
        logger.setLevel(log_level)

        if not logger.handlers:
            stdout_handler = logging.StreamHandler()
            fmt = "%(levelname)s - [%(name)s] %(message)s"
            stdout_handler.setFormatter(logging.Formatter(fmt))
            logger.addHandler(stdout_handler)

Automatically adding a stdout log handler like this is making our team sad. We want to control log level/output separately in our deployed app and ensure it goes through our structured logging output.

Ideally you would remove this or at least provide an option to disable this.

If you really must have this, could you iterate up the logging chain looking for handlers rather than looking specifically for one attached to the judoscale logger?

As a workaround we can add a null handler to the "judoscale" logger before starting judoscale config, but it was still a nuisance to track down the source of leaking stdout.

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