Log files not in log directory for golang

115 Views Asked by At

I am trying to log my info and error logs into the log/dir directory in my project instead of writing it to the stderr.I tried the solution given here:How do I set the log directory of glog from code but this isn't creating log files in my directory.....

This is my code

func init() {
    myDir, _ := os.Getwd()
    flag.Set("logtostderr", "true")
    flag.Set("log_dir", myDir+"/log/dir")
    flag.Parse()
        //Some other stuff
}

0

There are 0 best solutions below