Beego 引入beego1.9.0 项目运行多出来这样一行日志

mileStone · 2018年05月09日 · 最后由 jemygraw 回复于 2018年05月11日 · 174 次阅读
2018/05/09 09:34:11.377 [D] [server.go:2694] 127.0.0.1 - - [09/May/2018 09:34:11] "GET /Das/NewFuzzyQuery?ServiceName=test&page=1&rows=20 HTTP/1.1 200 0" 0.008878 http://127.0.0.1:8085/Das/DasService/test Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

2018/05/09 09:34:17.382 [I] [dasServiceDao.go:1313] webpath========= http://127.0.0.1:7252/todo?command=GetJsonPoints&pointIds=4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,
2018/05/09 09:34:17.383 [I] [dasServiceDao.go:1339] realtimepoint count------ 20
2018/05/09 09:34:17.384 [D] [server.go:2694] 127.0.0.1 - - [09/May/2018 09:34:17] "GET /Das/NewFuzzyQuery?ServiceName=test&page=1&rows=20 HTTP/1.1 200 0" 0.007401 http://127.0.0.1:8085/Das/DasService/test Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

2018/05/09 09:34:23.389 [I] [dasServiceDao.go:1313] webpath========= http://127.0.0.1:7252/todo?command=GetJsonPoints&pointIds=4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,
2018/05/09 09:34:23.390 [I] [dasServiceDao.go:1339] realtimepoint count------ 20
2018/05/09 09:34:23.392 [D] [server.go:2694] 127.0.0.1 - - [09/May/2018 09:34:23] "GET /Das/NewFuzzyQuery?ServiceName=test&page=1&rows=20 HTTP/1.1 200 0" 0.014106 http://127.0.0.1:8085/Das/DasService/test Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36



2018/05/09 09:34:34.683 [I] [dasServiceDao.go:1313] webpath========= http://127.0.0.1:7252/todo?command=GetJsonPoints&pointIds=4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,
2018/05/09 09:34:34.684 [I] [dasServiceDao.go:1339] realtimepoint count------ 20
2018/05/09 09:34:34.686 [D] [server.go:2694] 127.0.0.1 - - [09/May/2018 09:34:34] "GET /Das/NewFuzzyQuery?ServiceName=test&page=1&rows=20 HTTP/1.1 200 0" 0.006015 http://127.0.0.1:8085/Das/DasService/test Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

我用 beego1.9.0 后运行项目 总会输出这样的日志信息,

2018/05/09 09:34:34.686 [D] [server.go:2694] 127.0.0.1 - - [09/May/2018 09:34:34] "GET /Das/NewFuzzyQuery?ServiceName=test&page=1&rows=20 HTTP/1.1 200 0" 0.006015 http://127.0.0.1:8085/Das/DasService/test Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

我搜索也搜索不到这个 server.go 文件在什么地方,主要这个页面是一个定时刷新的页面, 不停的刷这个信息, 影响其他信息的分析, 各位有谁遇到这个问题。

更多原创文章干货分享,请关注公众号
  • 加微信实战群请加微信(注明:实战群):gocnio

这个是 accessLog, beego 的 log 有的时候显示的文件名和行号不准。 分析源码,在router.go里。

如果不想输出 access log, 可以禁用掉。

beego.BConfig.Log.AccessLogs = false

这个除了设置

beego.BConfig.Log.AccessLogs = false

之外,还需要是 pro 的模式下才不会出现:

beego.BConfig.RunMode = "pro"
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册