I wrote a simple application in golang which prints some messages in log file. I created a service with windows "sc create myapp binpath='path'". When I start the service It was created and messages were printed in log file.but windows tells "The process not responded". I want know what happens when we start a service and What the application should respond to windows service manager?
func main() {
_, err := os.Stat("C:/test.txt")
if err != nil {
f, _ = os.Create("C:/test.txt")
} else {
f, _ = os.Open("C:/test.txt")
}
log.SetOutput(f)
log.Println("Hello World!")
}