Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Judoscale interfering with logging configuration #94

Open
shughes-uk opened this issue Oct 23, 2024 · 1 comment
Open

Judoscale interfering with logging configuration #94

shughes-uk opened this issue Oct 23, 2024 · 1 comment

Comments

@shughes-uk
Copy link

shughes-uk commented Oct 23, 2024

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.

@adamlogic
Copy link
Contributor

@shughes-uk We don't want to make your team sad!!

You should be able to disable Judoscale logging by setting JUDOSCALE_LOG_LEVEL=CRITICAL. Does this work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants