Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refactor: log name without port (#20905)

Wang Qi2cfc74f8bd55
diff --git a/cmd/ragflow_server.go b/cmd/ragflow_server.go
index dcce2a8b94..eadf6130f9 100644
--- a/cmd/ragflow_server.go
+++ b/cmd/ragflow_server.go
@@ -537,9 +537,6 @@ func main() {
port = *arguments.port
apiServerConfig.HTTPPort = port
}
- if arguments.name == nil {
- serverName = fmt.Sprintf("api_server_%d", port)
- }
case "admin":
adminServerConfig := globalConfig.GetAdminServerConfig()
port := adminServerConfig.HTTPPort
@@ -547,9 +544,6 @@ func main() {
port = *arguments.port
adminServerConfig.HTTPPort = port
}
- if arguments.name == nil {
- serverName = fmt.Sprintf("admin_server_%d", port)
- }
case "ingestor":
if serverName == "" {
uuid := common.GenerateUUID()
diff --git a/internal/common/logger.go b/internal/common/logger.go
index b6cd18033c..3d0cae1180 100644
--- a/internal/common/logger.go
+++ b/internal/common/logger.go
@@ -201,15 +201,9 @@ func InitLogger(level string, file FileOutput, serviceName string) error {
}
stdoutSyncer := zapcore.AddSync(os.Stdout)
syncers := []zapcore.WriteSyncer{stdoutSyncer}
- // File sink only when a destination is actually configured. The cmd/*
- // entry points init the logger TWICE: a pre-config temporary logger
- // (before the port is known, e.g. "api_server" → logs/api_server.log)
- // and the real one after server.Init renames it (e.g.
- // "api_server_9384" → logs/api_server_9384.log). The temporary pass now
- // passes an empty FileOutput and stays stdout-only, so the pre-config
- // startup window no longer litters a second, orphaned log file next to
- // the real one (and ragflow-cli no longer drops a lumberjack file into
- // os.TempDir()).
+ // File sink only when a destination is actually configured. The server
+ // entry point initializes a temporary stdout-only logger before loading
+ // configuration, then reinitializes it with the configured file destination.
if file.Path != "" && file.Filename != "" {
ljLogger := &lumberjack.Logger{
Filename: filepath.Join(file.Path, file.Filename),