3

I'm trying to save Snakemake's own console output (not the logs generated by the individual jobs) to an arbitrary file while still having it written to stdout/stderr. (Unfortunately, my setup means I can't just use tee.)
It looks to me like Snakemake should provide that functionality, given it saves the log output to a default location. However, looking through the documentation, I couldn't find a parameter to easily change the output location for the log. From the code of snakemake.logging, I'm getting the impression the logfile's parent directory may be hardcoded, with the file just getting a timestamped name.

Is there some bleedingly obvious way to configure what file Snakemake logs to that I'm overlooking?

SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46
KeyboardCat
  • 442
  • 3
  • 12

2 Answers2

3

The file name/path is hardcoded in setup_logfile.

It's a hack, but one option is to copy the log file to the desired location using onsuccess/onerror (note that there is no oncompletion, so the log copying should probably apply to both cases):

onsuccess:
    shell("cp -v {log} some_path_for_log_copy.log")

onerror:
    shell("cp -v {log} some_path_for_log_copy.log")
SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46
0

As a workaround, it seems like you can symlink a directory that is located elsewhere into the directory that you're running Snakemake (provided it is still called .snakemake/) and it should work. In this way, you can store your log files elsewhere, but Snakemake will also be able to look in the correct location to find all its logs etc.

Fairlie Reese
  • 51
  • 1
  • 3