so i have a go application that has 3 different log output files, and each file has its own logger. when the application panics, the panic trace will always be written to the last logger to be opened, even if the origin of the panic isn't related to the domain of this specific log file.
that happens because in order to write panics i redirect the stderr output to the logger, and the last logger to be redirected to is the one that will be used
fh, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0777)
err = syscall.Dup2(int(fh.Fd()), int(os.Stderr.Fd()))
if err != nil {
fmt.Errorf("failed to redirect stderr to file: %v", err)
}
is there a way to have the panic always be written to a specific file? or somehow redirecting it to all files?
Thanks