spin icon indicating copy to clipboard operation
spin copied to clipboard

Log file collisions

Open adamreese opened this issue 2 years ago • 1 comments

When running two spin applications with the same name a single log file is appended. Because there isn't a restriction on unique spin application name, you can get some confusing logs.

A possible solution could storing logs to a default path in the current working directory. spin up --log-dir ./logs Another thought from the brilliant mind of @fibonacci1729 was hashing the spin.toml to use in the path.

adamreese avatar Apr 20 '22 18:04 adamreese

Hashing spin.toml may not be enough - consider two Bartholomew sites which use the same spin.toml but have different contents in their asset directories.

And working directory may not be helpful if things are being run from a bindle. (Even when running from a file, it may be best to avoid writing logs underneath the application root, because that could pollute the application content for the next run.)

A couple of thoughts:

  • Could this be left to the user? It seems like it wouldn't be a huge issue for typical interactive users, and in 'production-ish' environments the scheduler could generate distinct directory names maybe?
  • Is it important to have one log for the application or could there be one log per session, e.g. distinguished by start time?
  • Could you distinguish via (a safe version of) the path to spin.toml? In the bindle case, a safe version of the bindle ID might be enough, as the Bartholomew asset example would have to have different IDs. Still not necessarily guaranteed unique though.

itowlson avatar Apr 28 '22 04:04 itowlson