Access log¶
record access log as a handler in provider chain
usage¶
1.add this in provider chain, and as the first handler
servicecomb:
registry:
disabled: true
registry: manual
protocols: # what kind of server you want to launch
rest: #launch a http server
listenAddress: 127.0.0.1:5001
handler:
chain:
Provider:
default: access-log
2.add a config in lager.yaml
# can be a file path or stdout
# a file path: record access log in this file, recommend access file path' dir is same as log file'dir
# stdout: access log will record in console stdout
accessLogFile: xxx
3.import access log package
// should import after import go-chassis
_ "github.com/go-chassis/go-chassis/v2/middleware/accesslog"
4.verify
2021-08-30 10:02:56.684 +08:00 INFO accesslog/access_log.go:90 POST /v1/default/kie/kv from 127.0.0.1 409 5ms