I have program that programmatically changes stderr to write to a file, if
an error log has been defined in it's config file. That works fine, however
I have found that a runtime panic does not write to the error file. The
code I used follows:
errorLog, err := os.OpenFile(fqFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE,
0666)
exitOnError(err)
os.Stderr.Close()
// I have tried the following variations:
// os.Stderr = errorLog
// and...
stderrFD := int(errorLog.Fd())
err = syscall.Dup2(2, stderrFD)
exitOnError(err)
I have reviewed the documentation and tried searching on "golang panic" and
other terms, but have not found any useful information. Any help would be
much appreciated.
Thanks,
Daryl
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.