I've searched for it and only found here and here, but it not solves my problem.
How can I, using a standard way, identify the log separating the concurrent logs like JAVA does with thread ID? Because if I have a concurrent method then the logs will be printed mixed at the output, so I think that the LOGGER needs to have a way of identifying each request "thread"
Ex:
package main
import "log"
func main() {
/* simulating 10000 users requests */
i := 1;
for ;i < 10000; i++ {
go getHello(i)
}
}
func getHello(d int){
log.Printf("m=getHello, i=%d,begin", d)
log.Println("m=getHello, processing the hello message")
log.Printf("m=getHello, i=%d, end", d)
}
output
2016/07/29 15:59:46 m=getHello, i=1017,begin
2016/07/29 15:59:46 m=getHello, processing the hello message
2016/07/29 15:59:46 m=getHello, i=1017, end
2016/07/29 15:59:46 m=getHello, processing the hello message
2016/07/29 15:59:46 m=getHello, i=1038, end
2016/07/29 15:59:46 m=getHello, i=311,begin
2016/07/29 15:59:46 m=getHello, processing the hello message
2016/07/29 15:59:46 m=getHello, i=311, end
2016/07/29 15:59:46 m=getHello, i=1023,begin
2016/07/29 15:59:46 m=getHello, processing the hello message
2016/07/29 15:59:46 m=getHello, i=1023, end
2016/07/29 15:59:46 m=getHello, i=991,begin
2016/07/29 15:59:46 m=getHello, processing the hello message
2016/07/29 15:59:46 m=getHello, i=991, end
As you can see if I have not a int flag is impossible to know what of the requests have logged. In java,c,c#,delphy for example I simple logs the thread id and everything is ok.
Can you help me to do something like that in Golang? Thanks.
Obs: If my question is not good please tell me why on comments