logging - where does go write panic logs? -


i installed golang on redhat server through epel. i'm trying analyze panic logs can't find logs stored. hint ? there no trace in /var/log

      func main() {              http.handlefunc("/", panicrecover(test))             log.fatal(http.listenandserve(":80", nil))         }        func test(){         out, err := exec.command("echo ", "something").output()             if err != nil {                 log.panic(err)              }     }   func panicrecover(f func(w http.responsewriter, r *http.request)) func(w http.responsewriter, r *http.request) {     return func(w http.responsewriter, r *http.request) {         defer func() {             if r := recover(); r != nil {                 log.printf("panic recovered:%s\n", r)             }         }()         f(w, r)     } 

to stderr.

for example,

package main  import "log"  func main() {     log.panic("log.panic stderr") }   $ go run panic.go 2>stderr.txt 

stderr.txt file:

2014/06/09 00:30:54 log.panic stderr panic: log.panic stderr  goroutine 16 [running]: runtime.panic(0x497180, 0xc2080001a0)     /home/peter/go/src/pkg/runtime/panic.c:279 +0xf5 log.panic(0x7f88770fff20, 0x1, 0x1)     /home/peter/go/src/pkg/log/log.go:307 +0xb6 main.main()     /home/peter/gopath/src/so/panic.go:6 +0xa7  goroutine 17 [runnable]: runtime.mheap_scavenger()     /home/peter/go/src/pkg/runtime/mheap.c:507 runtime.goexit()     /home/peter/go/src/pkg/runtime/proc.c:1445  goroutine 18 [runnable]: bgsweep()     /home/peter/go/src/pkg/runtime/mgc0.c:1976 runtime.goexit()     /home/peter/go/src/pkg/runtime/proc.c:1445  goroutine 19 [runnable]: runfinq()     /home/peter/go/src/pkg/runtime/mgc0.c:2606 runtime.goexit()     /home/peter/go/src/pkg/runtime/proc.c:1445 exit status 2 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -