From 9c3d19053767070522c8d129e1dc8490f994d7bb Mon Sep 17 00:00:00 2001 From: Ming Deng <mindeng@ebay.com> Date: Wed, 25 Sep 2019 10:26:40 +0800 Subject: [PATCH] Add the AccessLogFilter into default filters and add example in comments of acccess_log_filter --- common/constant/default.go | 2 +- .../dubbo/go-server/profiles/dev/server.yml | 3 --- filter/impl/access_log_filter.go | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/common/constant/default.go b/common/constant/default.go index 405920e20..4363e3efd 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 13a63c0f7..1184fef4e 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 431aadcc0..cfbb6678c 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" + # 鐩稿綋浜巇ubbo.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 } -- GitLab