2

I'm having some trouble to set the right log configuration in Beego for production mod. While developing the log keeps on printing access logs but in production it stop. Even 404 are not printed. I tried to set the log level to Debug and set a new file logger but it still not printing access log.

func main() {
    runtime.GOMAXPROCS(8)
    beego.SetLevel(beego.LevelDebug)
    beego.SetLogger("file", `{"filename":"logs/test.log"}`)
    beego.Run()
}

Any help with this?

joaonrb
  • 965
  • 11
  • 30
  • `beego.SetLogger` returns an error, add some error checking and see if `SetLogger` is failing. – jmaloney Feb 05 '15 at 22:00
  • I got a nil from beego.SetLogger. I have no problem logging into logs/test.log. The problem is that I don't have access logs or error logs. Basically th only lines printed in log are: 2015/02/06 11:00:49 [app.go:96] [I] http server Running on :8080 – joaonrb Feb 06 '15 at 11:15

3 Answers3

2
func main() {
    beego.AccessLogs = true
    beego.Run()
}
0

It looks that the developers of Beego did this on purpose. Beego in production mode don't print access logs. Check the issue here.

joaonrb
  • 965
  • 11
  • 30
0

As for latest Beego, it would look like this.

func main() {
    beego.BConfig.Log.AccessLogs = true
    beego.Run()
}
Kotori0
  • 135
  • 2
  • 10