atomica.utils.start_logging(fname, reset=False)[source]

Log Atomica output to a file

This function automatically starts the file with a version record.

The file logger will potentially handle any log level, from 0 upwards. Therefore both stdout and stderr can potentially be logged. The stdout messages will be gated by the log level of at.logger. In practice, this means that the log file generated here will replicate whatever is being printed to the screen by the main Atomica process.

The key items that will NOT be captured in this file log are
  • Output generated by a print statement. Instead of using print, use‘message’) which will both print and log the output

  • Output generated by worker processes e.g. if using run_sampled_sims(parallel=True) This is because the workers can’t all write to the same log file without overwriting each other. Normal log output is typically suppressed anyway - however, stderr messages from the workers will be printed to the console but not logged in the file. These messages would typically corrupt the progress bar in the console anyway.

  • fname (str) – File name to write log file to

  • reset – If True, the previous file handler will be cleared and a new one opened. If the new log file has the same name as the old log file, the file will be cleared.

Return type: