unilog
unilog copied to clipboard
unilog should complain more forcefully if initial open of the output target fails
func (u *Unilog) reopen() error { /* open(u.target) or return err */ }
func (u *Unilog) Main() {
// [...]
u.target = flag.Arg(0)
u.reopen() // error is discarded
This makes it easy to accidentally misconfigure a system, especially if unilog's stderr is being sent to a different location than its output target.
Ideally, unilog should exit(1) if that first reopen fails -- that would make the problem easy to discover. For backwards compatibility, that exit may need to be put behind a flag so existing users can roll it out incrementally.
Good point!
To be clear, this wouldn't catch the issue we just found (the austerity file not being mounted), but that's by design - the austerity file shouldn't be a hard dependency for the system.
This issue is about a different problem -- say you ran Unilog writing to /remote-replicated-logs/some-job/output.log, and /remote-replicated-logs/some-job/ doesn't exist. If you didn't have remote visibility into the unilog stderr, then it would be difficult to notice that the logs are getting thrown away.