Skip to content

Commit

Permalink
Add the AccessLogFilter into default filters and add example in comme…
Browse files Browse the repository at this point in the history
…nts of acccess_log_filter
  • Loading branch information
flycash committed Sep 25, 2019
1 parent 17d2a8c commit 5ffe461
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/constant/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
const (
DEFAULT_KEY = "default"
PREFIX_DEFAULT_KEY = "default."
DEFAULT_SERVICE_FILTERS = "echo,token"
DEFAULT_SERVICE_FILTERS = "echo,token,accesslog"
DEFAULT_REFERENCE_FILTERS = ""
GENERIC_REFERENCE_FILTERS = "generic"
GENERIC = "$invoke"
Expand Down
3 changes: 0 additions & 3 deletions examples/general/dubbo/go-server/profiles/dev/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ registries :
username: ""
password: ""

# config your filter. for example, you wish to use the access log filter
#filter: "accesslog"

services:
"UserProvider":
# 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
Expand Down
17 changes: 16 additions & 1 deletion filter/impl/access_log_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,22 @@ const (
func init() {
extension.SetFilter(constant.ACCESS_LOG_KEY, GetAccessLogFilter)
}

/*
* Although the access log filter is a default filter,
* you should config "accesslog" in service's config to tell the filter where store the access log.
* for example:
* "UserProvider":
# 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
registry: "hangzhouzk"
protocol : "dubbo"
# 相当于dubbo.xml中的interface
interface : "com.ikurento.user.UserProvider"
... # other configuration
accesslog: "/your/path/to/store/the/log/", # it should be the path of file.
* the value of "accesslog" can be "true" or "default" too.
* If the value is one of them, the access log will be record in log file which defined in log.yml
*/
type AccessLogFilter struct {
logChan chan AccessLogData
}
Expand Down

0 comments on commit 5ffe461

Please sign in to comment.