Skip to content

Logging broken yet again #3558

@lczech

Description

@lczech

Snakemake version
9.3.3

Describe the bug
This is an extension of my earlier bug report here, which also seems to still be unresolved.

Minimal example

I've tried to adapt to the new logging setup now, but unfortunately, it seems even more broken than before.

import logging
logger_manager.logger.addHandler(logging.FileHandler("my.log"))

print("Message: print")
logger.info("Message: logger.info")
logger.warning("Message: logger.warning")


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

Logs
This behaves differently depending on whether an additional logger is added or not (first two lines).

Without extra log file: The terminal output only prints the "print" and "warning", but not the "info". The log file in .snakemake/log contains none of the three messages.

With the extra log file: The "warning" disappears from the terminal output, and instead appears in my.log now. The "print" remains in the terminal, the "info" still appears nowhere.

How can I add custom log messages in the new snakemake 9 that actually appear consistently? I would like for my custom info and warning log messages to show up in the terminal and in the log file. Right now, I'm adding the additional print to everything to make messages appear in the terminal, and I am promoting everything to a warning, so that it might at least show up in the snakmake log as well. Not ideal.

I'd appreciate any hints on how to either fix this with a workaround, or other suggestions! Thanks in advance :-)

Metadata

Metadata

Assignees

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