You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by la...@apache.org on 2021/09/10 11:56:51 UTC

[dubbo-go-samples] branch config-enhance updated: Ftr: add logger sample & readme (#240)

This is an automated email from the ASF dual-hosted git repository.

laurence pushed a commit to branch config-enhance
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/config-enhance by this push:
     new 3b0fa01  Ftr: add logger sample & readme (#240)
3b0fa01 is described below

commit 3b0fa01305efa38df7d6108ae33b5071eea7f719
Author: 氕氘氚 <cj...@163.com>
AuthorDate: Fri Sep 10 19:56:44 2021 +0800

    Ftr: add logger sample & readme (#240)
    
    * feat: add logger sample & readme
    
    * style: fmt code
    
    * style: add license
    
    * style: delete quotation and dubbo c
---
 .run/logger-client.run.xml                         |  15 --
 .run/logger-default.run.xml                        |  14 ++
 .run/logger-level.run.xml                          |  14 ++
 .run/logger-rolling.run.xml                        |  14 ++
 .run/logger-server.run.xml                         |  15 --
 logger/README.md                                   | 146 +++++++------------
 logger/README_zh.md                                | 159 ++++++++-------------
 .../{go-client/pkg/user.go => default/cmd/main.go} |  40 ++++--
 logger/default/conf/dubbogo.yml                    |  17 +++
 logger/go-client/cmd/client.go                     |  72 ----------
 logger/go-client/conf/client.yml                   |  59 --------
 logger/go-client/conf/log.yml                      |  36 -----
 logger/go-server/cmd/server.go                     |  80 -----------
 logger/go-server/conf/client.yml                   |  59 --------
 logger/go-server/conf/log.yml                      |  36 -----
 logger/go-server/conf/server.yml                   |  55 -------
 logger/go-server/docker/docker-compose.yml         |   9 --
 logger/go-server/docker/docker-health-check.sh     |  10 --
 logger/go-server/tests/integration/main_test.go    |  71 ---------
 .../userprovider_test.go => level/cmd/main.go}     |  42 ++++--
 logger/level/conf/dubbogo.yml                      |  17 +++
 .../{go-server/pkg/user.go => rolling/cmd/main.go} |  45 +++---
 logger/rolling/conf/dubbogo.yml                    |  25 ++++
 23 files changed, 289 insertions(+), 761 deletions(-)

diff --git a/.run/logger-client.run.xml b/.run/logger-client.run.xml
deleted file mode 100755
index 2517628..0000000
--- a/.run/logger-client.run.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-    <configuration default="false" name="logger-client" type="GoApplicationRunConfiguration" factoryName="Go Application" singleton="false">
-        <module name="dubbo-go-samples" />
-        <working_directory value="$PROJECT_DIR$" />
-        <envs>
-            <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/logger/go-client/conf/log.yml" />
-            <env name="CONF_CONSUMER_FILE_PATH" value="$PROJECT_DIR$/logger/go-client/conf/client.yml" />
-        </envs>
-        <kind value="PACKAGE" />
-        <filePath value="$PROJECT_DIR$/logger/go-client/cmd/client.go" />
-        <package value="github.com/apache/dubbo-go-samples/logger/go-client/cmd" />
-        <directory value="$PROJECT_DIR$" />
-        <method v="2" />
-    </configuration>
-</component>
\ No newline at end of file
diff --git a/.run/logger-default.run.xml b/.run/logger-default.run.xml
new file mode 100644
index 0000000..198ba4b
--- /dev/null
+++ b/.run/logger-default.run.xml
@@ -0,0 +1,14 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="logger-default" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="dubbo-go-samples" />
+    <working_directory value="$PROJECT_DIR$" />
+    <envs>
+      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/logger/default/conf/dubbogo.yml" />
+    </envs>
+    <kind value="PACKAGE" />
+    <package value="github.com/apache/dubbo-go-samples/logger/default/cmd" />
+    <directory value="$PROJECT_DIR$" />
+    <filePath value="$PROJECT_DIR$/logger/default/cmd/main.go" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.run/logger-level.run.xml b/.run/logger-level.run.xml
new file mode 100644
index 0000000..358dffa
--- /dev/null
+++ b/.run/logger-level.run.xml
@@ -0,0 +1,14 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="logger-level" type="GoApplicationRunConfiguration" factoryName="Go Application">
+    <module name="dubbo-go-samples" />
+    <working_directory value="$PROJECT_DIR$" />
+    <envs>
+      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/logger/level/conf/dubbogo.yml" />
+    </envs>
+    <kind value="PACKAGE" />
+    <package value="github.com/apache/dubbo-go-samples/logger/level/cmd" />
+    <directory value="$PROJECT_DIR$" />
+    <filePath value="$PROJECT_DIR$/logger/level/cmd/main.go" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.run/logger-rolling.run.xml b/.run/logger-rolling.run.xml
new file mode 100644
index 0000000..b66fd29
--- /dev/null
+++ b/.run/logger-rolling.run.xml
@@ -0,0 +1,14 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="logger-rolling" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
+    <module name="dubbo-go-samples" />
+    <working_directory value="$PROJECT_DIR$" />
+    <envs>
+      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/logger/rolling/conf/dubbogo.yml" />
+    </envs>
+    <kind value="PACKAGE" />
+    <package value="github.com/apache/dubbo-go-samples/logger/rolling/cmd" />
+    <directory value="$PROJECT_DIR$" />
+    <filePath value="$PROJECT_DIR$/logger/rolling/cmd/main.go" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.run/logger-server.run.xml b/.run/logger-server.run.xml
deleted file mode 100755
index 89f3fe5..0000000
--- a/.run/logger-server.run.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-    <configuration default="false" name="logger-server" type="GoApplicationRunConfiguration" factoryName="Go Application" singleton="false">
-        <module name="dubbo-go-samples" />
-        <working_directory value="$PROJECT_DIR$" />
-        <envs>
-            <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/logger/go-server/conf/log.yml" />
-            <env name="CONF_PROVIDER_FILE_PATH" value="$PROJECT_DIR$/logger/go-server/conf/server.yml" />
-        </envs>
-        <kind value="PACKAGE" />
-        <filePath value="$PROJECT_DIR$/logger/go-server/cmd/server.go" />
-        <package value="github.com/apache/dubbo-go-samples/logger/go-server/cmd" />
-        <directory value="$PROJECT_DIR$" />
-        <method v="2" />
-    </configuration>
-</component>
\ No newline at end of file
diff --git a/logger/README.md b/logger/README.md
index 3ea4e85..d217cba 100755
--- a/logger/README.md
+++ b/logger/README.md
@@ -2,9 +2,58 @@
 
 The samples demonstrate how to configure dubbo-go logger using lumberjack
 
-### Configuration
+### Contents
 
-Output file settings
+* default: print to the console by default
+* level:   set the isolation level of the log
+* rolling: output to file
+
+#### print to the console by default
+
+If you don't add a logger to the configuration file, the configuration log will be printed to the console. You can also configure the log in the configuration file. You can refer to the following method:
+
+zap log format and level settings
+```yaml
+    logger:
+    zapConfig:
+      level: "debug"
+      development: false
+      disableCaller: false
+      disableStacktrace: false
+      sampling:
+      encoding: "console"
+    
+      # encoder
+      encoderConfig:
+        messageKey: "message"
+        levelKey: "level"
+        timeKey: "time"
+        nameKey: "logger"
+        callerKey: "caller"
+        stacktraceKey: "stacktrace"
+        lineEnding: ""
+        levelEncoder: "capitalColor"
+        timeEncoder: "iso8601"
+        durationEncoder: "seconds"
+        callerEncoder: "short"
+        nameEncoder: ""
+    
+      outputPaths:
+        - "stderr"
+      errorOutputPaths:
+        - "stderr"
+      initialFields:
+```
+
+#### set isolation level
+
+```go
+logger.SetLoggerLevel("warn")
+```
+
+#### output to file
+
+Add the lumberjackConfig item under the logger option in the configuration file
 
 ```yaml
 lumberjackConfig:
@@ -21,96 +70,3 @@ lumberjackConfig:
   # Whether to compress the log file, the compression method is gzip
   compress: false
 ```
-
-Log format and level settings
-
-```yaml
-zapConfig:
-  level: "debug"
-  development: false
-  disableCaller: false
-  disableStacktrace: false
-  sampling:
-  encoding: "console"
-
-  # encoder
-  encoderConfig:
-    messageKey: "message"
-    levelKey: "level"
-    timeKey: "time"
-    nameKey: "logger"
-    callerKey: "caller"
-    stacktraceKey: "stacktrace"
-    lineEnding: ""
-    levelEncoder: "capitalColor"
-    timeEncoder: "iso8601"
-    durationEncoder: "seconds"
-    callerEncoder: "short"
-    nameEncoder: ""
-
-  outputPaths:
-    - "stderr"
-  errorOutputPaths:
-    - "stderr"
-  initialFields:
-```
-
-If you do not want to output to a file, you can follow the rules below to set only zap
-
-```yaml
-  level: "debug"
-  development: false
-  disableCaller: false
-  disableStacktrace: false
-  sampling:
-  encoding: "console"
-
-  # encoder
-  encoderConfig:
-    messageKey: "message"
-    levelKey: "level"
-    timeKey: "time"
-    nameKey: "logger"
-    callerKey: "caller"
-    stacktraceKey: "stacktrace"
-    lineEnding: ""
-    levelEncoder: "capitalColor"
-    timeEncoder: "iso8601"
-    durationEncoder: "seconds"
-    callerEncoder: "short"
-    nameEncoder: ""
-
-  outputPaths:
-    - "stderr"
-  errorOutputPaths:
-    - "stderr"
-  initialFields:
-```
-
-### Run
-
-A cycle of 1000000 times is set on the go-client side, and the server will be called all the time to facilitate the viewing of the log output
-
-```go
-func main() {
-	config.Load()
-	time.Sleep(3 * time.Second)
-
-	for i := 0;i < 1000000; i ++ {
-		test()
-	}
-
-}
-
-func test() {
-	logger.Info("\n\n\nstart to test dubbo")
-	user := &pkg.User{}
-	err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
-	if err != nil {
-		logger.Infof("error: %v\n", err)
-		os.Exit(1)
-		return
-	}
-	logger.Infof("response result: %v\n", user)
-}
-```
diff --git a/logger/README_zh.md b/logger/README_zh.md
index 94d432d..4be2140 100755
--- a/logger/README_zh.md
+++ b/logger/README_zh.md
@@ -2,115 +2,74 @@
 
  该 samples 演示了如何使用 lumberjack 配置 dubbo-go logger
 
-### 配置
+### 目录
 
-输出文件设置
+* default:  默认打印到控制台
+* level:    设置日志的隔离级别
+* rolling:  输出到文件
 
-```yaml
-lumberjackConfig:
-  # 写日志的文件名称
-  filename: "logs.log"
-  # 每个日志文件长度的最大大小,单位是 MiB。默认100MiB
-  maxSize: 1
-  # 日志保留的最大天数(只保留最近多少天的日志)
-  maxAge: 3
-  # 只保留最近多少个日志文件,用于控制程序总日志的大小
-  maxBackups: 5
-  # 是否使用本地时间,默认使用UTC时间
-  localTime: true
-  # 是否压缩日志文件,压缩方法gzip
-  compress: false
-```
-
-zap 日志格式和级别设置
-
-```yaml
-zapConfig:
-  level: "debug"
-  development: false
-  disableCaller: false
-  disableStacktrace: false
-  sampling:
-  encoding: "console"
-
-  # encoder
-  encoderConfig:
-    messageKey: "message"
-    levelKey: "level"
-    timeKey: "time"
-    nameKey: "logger"
-    callerKey: "caller"
-    stacktraceKey: "stacktrace"
-    lineEnding: ""
-    levelEncoder: "capitalColor"
-    timeEncoder: "iso8601"
-    durationEncoder: "seconds"
-    callerEncoder: "short"
-    nameEncoder: ""
-
-  outputPaths:
-    - "stderr"
-  errorOutputPaths:
-    - "stderr"
-  initialFields:
-```
+#### 默认配置
 
-如果不希望输出到文件中,可以按照如下规则,仅设置 zap
+在配置文件中不添加 logger 配置日志将会打印到控制台, 也可在配置文件中配置日志, 可参照如下方式: 
 
+zap 日志格式和级别设置
 ```yaml
-  level: "debug"
-  development: false
-  disableCaller: false
-  disableStacktrace: false
-  sampling:
-  encoding: "console"
-
-  # encoder
-  encoderConfig:
-    messageKey: "message"
-    levelKey: "level"
-    timeKey: "time"
-    nameKey: "logger"
-    callerKey: "caller"
-    stacktraceKey: "stacktrace"
-    lineEnding: ""
-    levelEncoder: "capitalColor"
-    timeEncoder: "iso8601"
-    durationEncoder: "seconds"
-    callerEncoder: "short"
-    nameEncoder: ""
-
-  outputPaths:
-    - "stderr"
-  errorOutputPaths:
-    - "stderr"
-  initialFields:
+    logger:
+    zapConfig:
+      level: "debug"
+      development: false
+      disableCaller: false
+      disableStacktrace: false
+      sampling:
+      encoding: "console"
+    
+      # encoder
+      encoderConfig:
+        messageKey: "message"
+        levelKey: "level"
+        timeKey: "time"
+        nameKey: "logger"
+        callerKey: "caller"
+        stacktraceKey: "stacktrace"
+        lineEnding: ""
+        levelEncoder: "capitalColor"
+        timeEncoder: "iso8601"
+        durationEncoder: "seconds"
+        callerEncoder: "short"
+        nameEncoder: ""
+    
+      outputPaths:
+        - "stderr"
+      errorOutputPaths:
+        - "stderr"
+      initialFields:
 ```
 
-### 运行
-
-在 go-client 端设置了一个 1000000 次的循环,会一直调用 server 来方便查看日志的输出情况
+#### 设置隔离级别
 
 ```go
-func main() {
-	config.Load()
-	time.Sleep(3 * time.Second)
+logger.SetLoggerLevel("warn")
+```
 
-	for i := 0;i < 1000000; i ++ {
-		test()
-	}
+#### 输出到文件
 
-}
+在配置文件中的 logger 选项下添加 lumberjackConfig 项
 
-func test() {
-	logger.Info("\n\n\nstart to test dubbo")
-	user := &pkg.User{}
-	err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
-	if err != nil {
-		logger.Infof("error: %v\n", err)
-		os.Exit(1)
-		return
-	}
-	logger.Infof("response result: %v\n", user)
-}
-```
+```yaml
+logger:
+    lumberjackConfig:
+      # 写日志的文件名称
+      filename: "logs.log"
+      # 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
+      maxSize: 1
+      # 日志保留的最大天数(只保留最近多少天的日志)
+      maxAge: 3
+      # 只保留最近多少个日志文件,用于控制程序总日志的大小
+      maxBackups: 5
+      # 是否使用本地时间,默认使用 UTC 时间
+      localTime: true
+      # 是否压缩日志文件,压缩方法 gzip
+      compress: false
+      # zap 配置可默认不填
+    zapConfig:
+```
\ No newline at end of file
diff --git a/logger/go-client/pkg/user.go b/logger/default/cmd/main.go
old mode 100755
new mode 100644
similarity index 56%
rename from logger/go-client/pkg/user.go
rename to logger/default/cmd/main.go
index 7733ea4..3e6eefd
--- a/logger/go-client/pkg/user.go
+++ b/logger/default/cmd/main.go
@@ -15,28 +15,40 @@
  * limitations under the License.
  */
 
-package pkg
+package main
 
 import (
 	"context"
 	"time"
 )
 
-type User struct {
-	ID   string
-	Name string
-	Age  int32
-	Time time.Time
-}
+import (
+	"dubbo.apache.org/dubbo-go/v3/common/logger"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+)
 
-type UserProvider struct {
-	GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-}
+import (
+	"github.com/apache/dubbo-go-samples/api"
+)
 
-func (u *UserProvider) Reference() string {
-	return "UserProvider"
+type GreeterProvider struct {
+	api.GreeterProviderBase
 }
 
-func (User) JavaClassName() string {
-	return "org.apache.dubbo.User"
+func main() {
+	config.SetProviderService(&GreeterProvider{})
+	config.Load()
+	ctx, _ := context.WithTimeout(context.Background(), time.Second*3)
+	for {
+		select {
+		case <-ctx.Done():
+			return
+		default:
+			logger.Info("hello dubbogo this is info log")
+			logger.Debug("hello dubbogo this is debug log")
+			logger.Warn("hello dubbogo this is warn log")
+			time.Sleep(time.Second * 1)
+		}
+	}
 }
diff --git a/logger/default/conf/dubbogo.yml b/logger/default/conf/dubbogo.yml
new file mode 100644
index 0000000..adfa82d
--- /dev/null
+++ b/logger/default/conf/dubbogo.yml
@@ -0,0 +1,17 @@
+dubbo:
+  registries:
+    demoZK:
+      protocol: zookeeper
+      timeout: 3s
+      address: 127.0.0.1:2181
+  protocols:
+    triple:
+      name: tri
+      port: 20000
+  provider:
+    registry:
+      - demoZK
+    services:
+      greeterImpl:
+        protocol: triple
+        interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/logger/go-client/cmd/client.go b/logger/go-client/cmd/client.go
deleted file mode 100755
index 7b7841a..0000000
--- a/logger/go-client/cmd/client.go
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
-	"context"
-	"os"
-	"time"
-)
-
-import (
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
-	"dubbo.apache.org/dubbo-go/v3/common/logger"
-	_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
-	"dubbo.apache.org/dubbo-go/v3/config"
-	_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
-	hessian "github.com/apache/dubbo-go-hessian2"
-)
-
-import (
-	"github.com/apache/dubbo-go-samples/logger/go-client/pkg"
-)
-
-var userProvider = new(pkg.UserProvider)
-
-func init() {
-	config.SetConsumerService(userProvider)
-	hessian.RegisterPOJO(&pkg.User{})
-}
-
-// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
-func main() {
-	config.Load()
-	time.Sleep(3 * time.Second)
-
-	for i := 0; i < 1000000; i++ {
-		test()
-	}
-
-}
-
-func test() {
-	logger.Info("\n\n\nstart to test dubbo")
-	user := &pkg.User{}
-	err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
-	if err != nil {
-		logger.Infof("error: %v\n", err)
-		os.Exit(1)
-		return
-	}
-	logger.Infof("response result: %v\n", user)
-}
diff --git a/logger/go-client/conf/client.yml b/logger/go-client/conf/client.yml
deleted file mode 100755
index 308d530..0000000
--- a/logger/go-client/conf/client.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout: "3s"
-# connect timeout
-connect_timeout: "3s"
-
-# application config
-application:
-  organization: "dubbo.io"
-  name: "UserInfoClient"
-  module: "dubbo-go user-info client"
-  version: "0.0.1"
-  environment: "dev"
-
-# registry config
-registries:
-  "demoZk":
-    protocol: "zookeeper"
-    timeout: "3s"
-    address: "127.0.0.1:2181"
-    username: ""
-    password: ""
-
-# reference config
-references:
-  "UserProvider":
-    registry: "demoZk"
-    protocol: "dubbo"
-    interface: "org.apache.dubbo.UserProvider"
-    cluster: "failover"
-    methods:
-      - name: "GetUser"
-        retries: 3
-
-# protocol config
-protocol_conf:
-  dubbo:
-    reconnect_interval: 0
-    connection_number: 1
-    heartbeat_period: "5s"
-    session_timeout: "180s"
-    pool_size: 64
-    pool_ttl: 600
-    getty_session_param:
-      compress_encoding: false
-      tcp_no_delay: true
-      tcp_keep_alive: true
-      keep_alive_period: "120s"
-      tcp_r_buf_size: 262144
-      tcp_w_buf_size: 65536
-      pkg_rq_size: 1024
-      pkg_wq_size: 512
-      tcp_read_timeout: "1s"
-      tcp_write_timeout: "5s"
-      wait_timeout: "1s"
-      max_msg_len: 1024000
-      session_name: "client"
diff --git a/logger/go-client/conf/log.yml b/logger/go-client/conf/log.yml
deleted file mode 100755
index 75cc32c..0000000
--- a/logger/go-client/conf/log.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-lumberjackConfig:
-  filename: "logs.log"
-  maxSize: 1
-  maxAge: 3
-  maxBackups: 5
-  localTime: true
-  compress: false
-
-zapConfig:
-  level: "debug"
-  development: false
-  disableCaller: false
-  disableStacktrace: false
-  sampling:
-  encoding: "console"
-
-  # encoder
-  encoderConfig:
-    messageKey: "message"
-    levelKey: "level"
-    timeKey: "time"
-    nameKey: "logger"
-    callerKey: "caller"
-    stacktraceKey: "stacktrace"
-    lineEnding: ""
-    levelEncoder: "capitalColor"
-    timeEncoder: "iso8601"
-    durationEncoder: "seconds"
-    callerEncoder: "short"
-    nameEncoder: ""
-
-  outputPaths:
-    - "stderr"
-  errorOutputPaths:
-    - "stderr"
-  initialFields:
diff --git a/logger/go-server/cmd/server.go b/logger/go-server/cmd/server.go
deleted file mode 100755
index d26cdf2..0000000
--- a/logger/go-server/cmd/server.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
-	"fmt"
-	"os"
-	"os/signal"
-	"syscall"
-	"time"
-)
-
-import (
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
-	"dubbo.apache.org/dubbo-go/v3/common/logger"
-	_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
-	"dubbo.apache.org/dubbo-go/v3/config"
-	_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
-	hessian "github.com/apache/dubbo-go-hessian2"
-)
-
-import (
-	"github.com/apache/dubbo-go-samples/logger/go-server/pkg"
-)
-
-var (
-	survivalTimeout = int(3e9)
-)
-
-// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
-func main() {
-	hessian.RegisterPOJO(&pkg.User{})
-	config.SetProviderService(new(pkg.UserProvider))
-	config.Load()
-
-	initSignal()
-}
-
-func initSignal() {
-	signals := make(chan os.Signal, 1)
-	// It is not possible to block SIGKILL or syscall.SIGSTOP
-	signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
-	for {
-		sig := <-signals
-		logger.Infof("get signal %s", sig.String())
-		switch sig {
-		case syscall.SIGHUP:
-			// reload()
-		default:
-			time.AfterFunc(time.Duration(survivalTimeout), func() {
-				logger.Warnf("app exit now by force...")
-				os.Exit(1)
-			})
-
-			// The program exits normally or timeout forcibly exits.
-			fmt.Println("provider app exit now...")
-			return
-		}
-	}
-}
diff --git a/logger/go-server/conf/client.yml b/logger/go-server/conf/client.yml
deleted file mode 100755
index 11ae382..0000000
--- a/logger/go-server/conf/client.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout: "3s"
-# connect timeout
-connect_timeout: "3s"
-
-# application config
-application:
-  organization: "dubbo.io"
-  name: "UserInfoTest"
-  module: "dubbo-go user-info client"
-  version: "0.0.1"
-  environment: "dev"
-
-# registry config
-registries:
-  "demoZk":
-    protocol: "zookeeper"
-    timeout: "3s"
-    address: "127.0.0.1:2181"
-    username: ""
-    password: ""
-
-# reference config
-references:
-  "UserProvider":
-    registry: "demoZk"
-    protocol: "dubbo"
-    interface: "org.apache.dubbo.UserProvider"
-    cluster: "failover"
-    methods:
-      - name: "GetUser"
-        retries: 3
-
-# protocol config
-protocol_conf:
-  dubbo:
-    reconnect_interval: 0
-    connection_number: 1
-    heartbeat_period: "5s"
-    session_timeout: "180s"
-    pool_size: 64
-    pool_ttl: 600
-    getty_session_param:
-      compress_encoding: false
-      tcp_no_delay: true
-      tcp_keep_alive: true
-      keep_alive_period: "120s"
-      tcp_r_buf_size: 262144
-      tcp_w_buf_size: 65536
-      pkg_rq_size: 1024
-      pkg_wq_size: 512
-      tcp_read_timeout: "1s"
-      tcp_write_timeout: "5s"
-      wait_timeout: "1s"
-      max_msg_len: 1024000
-      session_name: "client"
diff --git a/logger/go-server/conf/log.yml b/logger/go-server/conf/log.yml
deleted file mode 100755
index c5e1068..0000000
--- a/logger/go-server/conf/log.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-lumberjackConfig:
-  filename: "logs.log"
-  maxSize: 4
-  maxAge: 3
-  maxBackups: 5
-  localTime: true
-  compress: false
-
-zapConfig:
-  level: "debug"
-  development: false
-  disableCaller: false
-  disableStacktrace: false
-  sampling:
-  encoding: "console"
-
-  # encoder
-  encoderConfig:
-    messageKey: "message"
-    levelKey: "level"
-    timeKey: "time"
-    nameKey: "logger"
-    callerKey: "caller"
-    stacktraceKey: "stacktrace"
-    lineEnding: ""
-    levelEncoder: "capitalColor"
-    timeEncoder: "iso8601"
-    durationEncoder: "seconds"
-    callerEncoder: "short"
-    nameEncoder: ""
-
-  outputPaths:
-    - "stderr"
-  errorOutputPaths:
-    - "stderr"
-  initialFields:
diff --git a/logger/go-server/conf/server.yml b/logger/go-server/conf/server.yml
deleted file mode 100755
index af90434..0000000
--- a/logger/go-server/conf/server.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-# dubbo server yaml configure file
-
-# application config
-application:
-  organization: "dubbo.io"
-  name: "UserInfoServer"
-  module: "dubbo-go user-info server"
-  version: "0.0.1"
-  environment: "dev"
-
-# registry config
-registries:
-  "demoZk":
-    protocol: "zookeeper"
-    timeout: "3s"
-    address: "127.0.0.1:2181"
-
-# service config
-services:
-  "UserProvider":
-    registry: "demoZk"
-    protocol: "dubbo"
-    interface: "org.apache.dubbo.UserProvider"
-    loadbalance: "random"
-    warmup: "100"
-    cluster: "failover"
-    methods:
-      - name: "GetUser"
-        retries: 1
-        loadbalance: "random"
-
-# protocol config
-protocols:
-  "dubbo":
-    name: "dubbo"
-    port: 20000
-
-protocol_conf:
-  dubbo:
-    session_number: 700
-    session_timeout: "180s"
-    getty_session_param:
-      compress_encoding: false
-      tcp_no_delay: true
-      tcp_keep_alive: true
-      keep_alive_period: "120s"
-      tcp_r_buf_size: 262144
-      tcp_w_buf_size: 65536
-      pkg_rq_size: 1024
-      pkg_wq_size: 512
-      tcp_read_timeout: "1s"
-      tcp_write_timeout: "5s"
-      wait_timeout: "1s"
-      max_msg_len: 1024000
-      session_name: "server"
diff --git a/logger/go-server/docker/docker-compose.yml b/logger/go-server/docker/docker-compose.yml
deleted file mode 100755
index 8724179..0000000
--- a/logger/go-server/docker/docker-compose.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-version: '3'
-
-services:
-  zookeeper:
-    image: zookeeper
-    ports:
-      - 2181:2181
-    restart: on-failure
-
diff --git a/logger/go-server/docker/docker-health-check.sh b/logger/go-server/docker/docker-health-check.sh
deleted file mode 100755
index 2cc32c2..0000000
--- a/logger/go-server/docker/docker-health-check.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-curl 127.0.0.1:2181
-res=$?
-passCode=52
-while [ "$res" != "$passCode" ];do
-  sleep 5
-  curl 127.0.0.1:2181
-  res=$?
-done
-
-sleep 5
diff --git a/logger/go-server/tests/integration/main_test.go b/logger/go-server/tests/integration/main_test.go
deleted file mode 100755
index d028c55..0000000
--- a/logger/go-server/tests/integration/main_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// +build integration
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package integration
-
-import (
-	"context"
-	"os"
-	"testing"
-	"time"
-)
-
-import (
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
-	_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
-	"dubbo.apache.org/dubbo-go/v3/config"
-	_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
-	_ "dubbo.apache.org/dubbo-go/v3/metadata/service/local"
-	_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
-	hessian "github.com/apache/dubbo-go-hessian2"
-)
-
-var userProvider = new(UserProvider)
-
-func TestMain(m *testing.M) {
-	config.SetConsumerService(userProvider)
-	hessian.RegisterPOJO(&User{})
-	config.Load()
-	time.Sleep(3 * time.Second)
-
-	os.Exit(m.Run())
-}
-
-type User struct {
-	ID   string
-	Name string
-	Age  int32
-	Time time.Time
-}
-
-type UserProvider struct {
-	GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-}
-
-func (u *UserProvider) Reference() string {
-	return "UserProvider"
-}
-
-func (User) JavaClassName() string {
-	return "org.apache.dubbo.User"
-}
diff --git a/logger/go-server/tests/integration/userprovider_test.go b/logger/level/cmd/main.go
old mode 100755
new mode 100644
similarity index 55%
rename from logger/go-server/tests/integration/userprovider_test.go
rename to logger/level/cmd/main.go
index 7183e64..395035c
--- a/logger/go-server/tests/integration/userprovider_test.go
+++ b/logger/level/cmd/main.go
@@ -1,5 +1,3 @@
-// +build integration
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -17,23 +15,41 @@
  * limitations under the License.
  */
 
-package integration
+package main
 
 import (
 	"context"
-	"testing"
+	"time"
+)
+
+import (
+	"dubbo.apache.org/dubbo-go/v3/common/logger"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
 )
 
 import (
-	"github.com/stretchr/testify/assert"
+	"github.com/apache/dubbo-go-samples/api"
 )
 
-func TestGetUser(t *testing.T) {
-	user := &User{}
-	err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
-	assert.Nil(t, err)
-	assert.Equal(t, "A001", user.ID)
-	assert.Equal(t, "Alex Stocks", user.Name)
-	assert.Equal(t, int32(18), user.Age)
-	assert.NotNil(t, user.Time)
+type GreeterProvider struct {
+	api.GreeterProviderBase
+}
+
+func main() {
+	config.SetProviderService(&GreeterProvider{})
+	config.Load()
+	ctx, _ := context.WithTimeout(context.Background(), time.Second*3)
+	logger.SetLoggerLevel("warn")
+	for {
+		select {
+		case <-ctx.Done():
+			return
+		default:
+			logger.Info("hello dubbogo this is info log")
+			logger.Debug("hello dubbogo this is debug log")
+			logger.Warn("hello dubbogo this is warn log")
+			time.Sleep(time.Second * 1)
+		}
+	}
 }
diff --git a/logger/level/conf/dubbogo.yml b/logger/level/conf/dubbogo.yml
new file mode 100644
index 0000000..adfa82d
--- /dev/null
+++ b/logger/level/conf/dubbogo.yml
@@ -0,0 +1,17 @@
+dubbo:
+  registries:
+    demoZK:
+      protocol: zookeeper
+      timeout: 3s
+      address: 127.0.0.1:2181
+  protocols:
+    triple:
+      name: tri
+      port: 20000
+  provider:
+    registry:
+      - demoZK
+    services:
+      greeterImpl:
+        protocol: triple
+        interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/logger/go-server/pkg/user.go b/logger/rolling/cmd/main.go
old mode 100755
new mode 100644
similarity index 58%
rename from logger/go-server/pkg/user.go
rename to logger/rolling/cmd/main.go
index 8e34bf0..6bf5ee5
--- a/logger/go-server/pkg/user.go
+++ b/logger/rolling/cmd/main.go
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package pkg
+package main
 
 import (
 	"context"
@@ -23,30 +23,31 @@ import (
 )
 
 import (
-	"github.com/dubbogo/gost/log"
+	"dubbo.apache.org/dubbo-go/v3/common/logger"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
 )
 
-type User struct {
-	ID   string
-	Name string
-	Age  int32
-	Time time.Time
-}
-
-type UserProvider struct {
-}
-
-func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
-	gxlog.CInfo("req:%#v", req)
-	rsp := User{"A001", "Alex Stocks", 18, time.Now()}
-	gxlog.CInfo("rsp:%#v", rsp)
-	return &rsp, nil
-}
+import (
+	"github.com/apache/dubbo-go-samples/api"
+)
 
-func (u *UserProvider) Reference() string {
-	return "UserProvider"
+type GreeterProvider struct {
+	api.GreeterProviderBase
 }
 
-func (u User) JavaClassName() string {
-	return "org.apache.dubbo.User"
+func main() {
+	config.SetProviderService(&GreeterProvider{})
+	config.Load()
+	ctx, _ := context.WithTimeout(context.Background(), time.Second*20)
+	for {
+		select {
+		case <-ctx.Done():
+			return
+		default:
+			logger.Info("hello dubbogo this is info log")
+			logger.Debug("hello dubbogo this is debug log")
+			logger.Warn("hello dubbogo this is warn log")
+		}
+	}
 }
diff --git a/logger/rolling/conf/dubbogo.yml b/logger/rolling/conf/dubbogo.yml
new file mode 100644
index 0000000..cbd4623
--- /dev/null
+++ b/logger/rolling/conf/dubbogo.yml
@@ -0,0 +1,25 @@
+dubbo:
+  registries:
+    demoZK:
+      protocol: zookeeper
+      timeout: 3s
+      address: 127.0.0.1:2181
+  protocols:
+    triple:
+      name: tri
+      port: 20000
+  provider:
+    registry:
+      - demoZK
+    services:
+      greeterImpl:
+        protocol: triple
+        interface: com.apache.dubbo.sample.basic.IGreeter # must be compatible with grpc or dubbo-java
+  logger:
+    lumberjack-config:
+      filename: logs.log
+      maxSize: 1
+      maxAge: 3
+      maxBackups: 5
+      localTime: true
+      compress: false
\ No newline at end of file