Skip to content

Custom logging messages no longer appear in log file #2974

@lczech

Description

@lczech

Snakemake version
8.15.2

Describe the bug
In previous versions of Snakemake (I was using 6.0.5.), I could log custom messages using logger.info(), and they would show up in both the terminal output, and in the log file in .snakemake/log. Now, testing with Snakemake 8.15.2, they only get printed on the terminal, but no longer in the log file.

Minimal example

logger.info("Running my workflow")

rule all:
    output:
        touch("result.txt")

Expected behavior: the line "Running my workflow" is printed to terminal, and to the log file.
Snakemake 6.0.5: works as expected
Snakemake 8.15.2: only output on the terminal, not in the log file in .snakemake/log.

Additional context
I tried to see if there were any changes in the initialization of the Logger class, but could not figure out which part in snakemake/logging.py was changed that resulted in this behaviour.

I also tried a simple print() statement, but of course that does not end of in the log file either.

This is rather unfortunate, because I was using this to log details about the runtime environment of each call of the workflow, which greatly helped debugging my user's problems. Now I cannot ask them to simply send me the log file any more, but will have to ask them to copy that information manually. Please fix this, or let me know how I can change the logger to work as expected again.

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