Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Nacos client logDir path seperator #591

Merged
merged 3 commits into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion before_ut.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set zkJarPath=remoting/zookeeper/zookeeper-4unittest/contrib/fatjar
set zkJar=%zkJarPath%/%zkJarName%

if not exist "%zkJar%" (
md %zkJarPath%
md "%zkJarPath%"
curl -L %remoteJarUrl% -o %zkJar%
)

Expand Down
1 change: 1 addition & 0 deletions common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const (
CONFIG_CLUSTER_KEY = "config.cluster"
CONFIG_CHECK_KEY = "config.check"
CONFIG_TIMEOUT_KET = "config.timeout"
CONFIG_LOG_DIR_KEY = "config.logDir"
CONFIG_VERSION_KEY = "configVersion"
COMPATIBLE_CONFIG_KEY = "compatible_config"
)
Expand Down
2 changes: 2 additions & 0 deletions config/config_center_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type ConfigCenterConfig struct {
Group string `default:"dubbo" yaml:"group" json:"group,omitempty"`
Username string `yaml:"username" json:"username,omitempty"`
Password string `yaml:"password" json:"password,omitempty"`
LogDir string `yaml:"log_dir" json:"log_dir,omitempty"`
ConfigFile string `default:"dubbo.properties" yaml:"config_file" json:"config_file,omitempty"`
Namespace string `default:"dubbo" yaml:"namespace" json:"namespace,omitempty"`
AppConfigFile string `default:"dubbo.properties" yaml:"app_config_file" json:"app_config_file,omitempty"`
Expand Down Expand Up @@ -73,5 +74,6 @@ func (c *ConfigCenterConfig) GetUrlMap() url.Values {
urlMap.Set(constant.CONFIG_GROUP_KEY, c.Group)
urlMap.Set(constant.CONFIG_CLUSTER_KEY, c.Cluster)
urlMap.Set(constant.CONFIG_APP_ID_KEY, c.AppId)
urlMap.Set(constant.CONFIG_LOG_DIR_KEY, c.LogDir)
return urlMap
}
5 changes: 4 additions & 1 deletion config_center/nacos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package nacos

import (
"path/filepath"
"strconv"
"strings"
"sync"
Expand All @@ -36,7 +37,8 @@ import (
"github.com/apache/dubbo-go/common/logger"
)

const logDir = "logs/nacos/log"
// Nacos Log dir, it can be override when creating client by config_center.log_dir
var logDir = filepath.Join("logs", "nacos", "log")

// NacosClient Nacos client
type NacosClient struct {
Expand Down Expand Up @@ -87,6 +89,7 @@ func ValidateNacosClient(container nacosClientFacade, opts ...option) error {
}

url := container.GetUrl()
logDir = url.GetParam(constant.CONFIG_LOG_DIR_KEY, logDir)

if container.NacosClient() == nil {
//in dubbo ,every registry only connect one node ,so this is []string{r.Address}
Expand Down