I'm currently working on recreating the issue in a condensed example, but in the meantime, I want to see if anyone has any ideas on what might be happening.
I have several private packages being used by main (
github.com/codegangsta/cli):
private/project/cmd
private/packagea
private/packageb
Each package, including main uses the following (each with their own prefix):
var (
Logger *log.Logger = log.New(os.NewFile(uintptr(syscall.Stderr), os.DevNull), "packagea: ", log.LstdFlags)
)
In main, during app.Before, I set the output for each logger with 'packagea.Logger.SetOutput(os.Stderr)'. I have it set up this way because I have a custom writer which has some filters in it, which I have since replaced with os.StdErr until I fix the issue.
All logging works great, I'll see messages in StdErr with prefixes of main, packagea, packageb, etc. Toward the end of execution of main, logging ceases to occur, and main exits with a 0. I print the logger after I know a log should have occurred and see that there are bytes in the buffer.
I then switch one of the loggers outputs to os.Stdout durring app.Before that I know should be printing and it works!Any ideas as to why the output of some of the loggers are not being flushed? I did not think any type of lock was needed against os.Stderr / os.Stdout. Again, I'm working on recreating a slimmed down example that I will post here soon if I can recreate it.
Thanks,
Kyle