Skip to content

snakemake >8.0.0 does not respect custom logging config #3044

@samimia-swks

Description

@samimia-swks

With Snakemake 7.32.4, I could have a SnakeFile like this where I reconfigured the log format of snakemake to be consistent with the log format used by the rest of my python code :

import logging.config

log_dict_config = {
        "version": 1,
        "disable_existing_loggers": False,
        'formatters': {
            'standard': {
                'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
            },
        },
        "handlers": {
            "console": {
                'level': 'INFO',
                'formatter': 'standard',
                'class': 'logging.StreamHandler',
                'stream': 'ext://sys.stdout',  # Default is stderr
            },
        },
        "loggers": {
            "snakemake": {
                "level": "DEBUG",
                "handlers": ["console"],
                "propagate": False,
            },
        },
    }

logging.config.dictConfig(log_dict_config)

This worked as expected:

$ snakemake --cores 1
2024-08-23 19:43:38,047 [WARNING] snakemake.logging: Building DAG of jobs...
2024-08-23 19:43:38,049 [WARNING] snakemake.logging: Nothing to be done (all requested files are present and up to date).
2024-08-23 19:43:38,049 [WARNING] snakemake.logging: Complete log: .snakemake/log/2024-08-23T194337.961575.snakemake.log

With Snakemake 8.0.0 and higher, the custom formatted logs still print, but snakemake itself seems to be printing its own lines in yellow as well, so every log message is repeated:

$ snakemake --cores 1
Building DAG of jobs...
2024-08-23 19:47:35,891 [WARNING] snakemake.logging: Building DAG of jobs...
Retrieving input from storage.
2024-08-23 19:47:35,893 [WARNING] snakemake.logging: Retrieving input from storage.
Nothing to be done (all requested files are present and up to date).
2024-08-23 19:47:35,893 [WARNING] snakemake.logging: Nothing to be done (all requested files are present and up to date).

How do I get the previous behavior back?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions