You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/07/16 03:15:32 UTC

[GitHub] [servicecomb-service-center] aseTo2016 commented on a change in pull request #599: [SCB-1545] add support env config for logfilepath and logfile level

aseTo2016 commented on a change in pull request #599:
URL: https://github.com/apache/servicecomb-service-center/pull/599#discussion_r455481035



##########
File path: server/core/config.go
##########
@@ -76,6 +76,19 @@ func newInfo() pb.ServerInformation {
 		serviceTTL = defaultServiceTTL
 	}
 
+	logLevelEnv := os.Getenv("SC_LOG_LEVEL")
+	logFilePathEnv := os.Getenv("SC_LOG_FILEPATH")
+
+	logFilePath := beego.AppConfig.String("logfile")
+	if logFilePathEnv!= ""{

Review comment:
       代码是否没有格式化

##########
File path: server/core/config.go
##########
@@ -76,6 +76,19 @@ func newInfo() pb.ServerInformation {
 		serviceTTL = defaultServiceTTL
 	}
 
+	logLevelEnv := os.Getenv("SC_LOG_LEVEL")
+	logFilePathEnv := os.Getenv("SC_LOG_FILEPATH")
+
+	logFilePath := beego.AppConfig.String("logfile")
+	if logFilePathEnv!= ""{
+		logFilePath = logFilePathEnv
+	}
+
+	loglevel :=  beego.AppConfig.String("loglevel");
+	if logLevelEnv!= ""{

Review comment:
       建议在app.conf里面修改,显得更加清晰简单
   loglevel= "${SC_LOG_LEVEL||}",beego是支持从环境变量获取,如果为空,使用||后面默认的




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org