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

I can not remove this waring. #2558

Closed
majintao opened this issue Jan 3, 2024 · 3 comments
Closed

I can not remove this waring. #2558

majintao opened this issue Jan 3, 2024 · 3 comments

Comments

@majintao
Copy link

majintao commented Jan 3, 2024

2024-01-03 18:47:45.742 WARN tag/router.go:87 [-] config center does not start, please check if the configuration center has been properly configured in dubbogo.yml%!(EXTRA []interface {}=[]) {"SW_CTX": "[xf-app,639f89eeaa2511eebcf552f3f496997d@192.168.24.77,N/A,N/A,-1]"}

@majintao
Copy link
Author

majintao commented Jan 3, 2024

func Start(conf Conf) error {
if conf.LogLevel == "" {
conf.LogLevel = "error"
}
logger.SetLoggerLevel(conf.LogLevel)

applicationConfig := config.NewApplicationConfigBuilder().SetName(conf.AppName).Build()

protocolConfigs := make(map[string]*config.ProtocolConfig, 0)
if conf.ProtocolConfig.Name != "" {
	// 根据配置设置启动参数
	clientConfig := getty.GetDefaultClientConfig()
	params := conf.ProtocolConfig.Params
	if params.GrPoolSize != 0 {
		clientConfig.GrPoolSize = params.GrPoolSize
	}

	if params.ConnectionNumber != 0 {
		clientConfig.ConnectionNum = params.ConnectionNumber
	}

	if params.MaxMsgLen != 0 {
		clientConfig.GettySessionParam.MaxMsgLen = params.MaxMsgLen
	}

	if params.SessionName != "" {
		clientConfig.GettySessionParam.SessionName = params.SessionName
	}

	dubboPort := strconv.Itoa(conf.ProtocolConfig.Port)
	if dubboPort == "" {
		dubboPort = "-1"
	}
	dubboProtocolConfig := config.NewProtocolConfigBuilder().
		SetName(conf.ProtocolConfig.Name).SetPort(dubboPort).SetParams(clientConfig).Build()
	protocolConfigs[conf.ProtocolConfig.Name] = dubboProtocolConfig
} else {
	// 默认配置
	defaultProtocolName := "dubbo"
	defaultDubboProtocolConfig := config.NewProtocolConfigBuilder().
		SetName(defaultProtocolName).SetPort("-1").Build()
	protocolConfigs[defaultProtocolName] = defaultDubboProtocolConfig
}

consumerConfig := config.NewConsumerConfigBuilder().SetCheck(false).SetReferences(References).Build()
providerConfig := config.NewProviderConfigBuilder().SetServices(Services).Build()

registryConfigs := make(map[string]*config.RegistryConfig, 0)
for _, registry := range conf.Registries {
	registryConfigs[registry.Name] = config.NewRegistryConfigBuilder().
		SetProtocol(registry.Protocol).
		SetTimeout(registry.Timeout).
		SetRegistryType(registry.RegistryType).
		SetAddress(registry.Address).Build()
}

loggerConfig := config.NewLoggerConfigBuilder().SetDriver("zap").SetLevel("error").Build()
rootConfig := config.NewRootConfigBuilder().
	SetApplication(applicationConfig).
	SetConsumer(consumerConfig).
	SetProvider(providerConfig).
	SetProtocols(protocolConfigs).
	SetLogger(loggerConfig).
	SetConfigCenter(config.NewConfigCenterConfigBuilder().Build()).
	SetRegistries(registryConfigs).Build()

err := config.Load(config.WithRootConfig(rootConfig))

if err != nil {
	return err
}

// 处理日志替换
logger.SetLogger(NewCustomLogger(xflog.GetLogger().AddCallerSkip(2)))
logger.SetLoggerLevel(conf.LogLevel)

return nil

}

@FinalT
Copy link
Member

FinalT commented Jan 3, 2024

I will fix this soon

@DMwangnima
Copy link
Contributor

Resolved by #2559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants