diff --git a/common/constant/default.go b/common/constant/default.go index 405920e20f..4363e3efd5 100644 --- a/common/constant/default.go +++ b/common/constant/default.go @@ -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" diff --git a/examples/general/dubbo/go-server/profiles/dev/server.yml b/examples/general/dubbo/go-server/profiles/dev/server.yml index 13a63c0f78..1184fef4e2 100644 --- a/examples/general/dubbo/go-server/profiles/dev/server.yml +++ b/examples/general/dubbo/go-server/profiles/dev/server.yml @@ -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,使用逗号隔开;不指定默认向所有注册中心注册 diff --git a/filter/impl/access_log_filter.go b/filter/impl/access_log_filter.go index 431aadcc08..cfbb6678c0 100644 --- a/filter/impl/access_log_filter.go +++ b/filter/impl/access_log_filter.go @@ -48,6 +48,22 @@ 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 }