-
Notifications
You must be signed in to change notification settings - Fork 66
Conversation
Some printf will affect DM who uses Lightning as a library. |
lightning/config/global.go
Outdated
if *logFilePath != "" { | ||
cfg.App.Config.File = *logFilePath | ||
} else { | ||
configFile, err := log.AdjustLogFilePath() | ||
if err != nil { | ||
return nil, errors.Annotate(err, "Create debug logs directory failed") | ||
} | ||
cfg.App.Config.File = configFile | ||
fmt.Fprintf(os.Stdout, "Verbose debug logs will be written to %s.\n\n", configFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should still be a way to explicitly use stderr
as log output.
i suggest using BR's approach of making the default value of the CLI parameter to be the log path.
I move all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
cmd/tidb-lightning/main.go
Outdated
} else { | ||
logger.Info("tidb lightning exit") | ||
fmt.Fprintln(os.Stdout, "tidb lightning exit", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Fprintln(os.Stdout, "tidb lightning exit", err) | |
fmt.Fprintln(os.Stdout, "tidb lightning exit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
#307
Now lightning print logs directly to console if the user doesn't set log path. The stack info will confuse the users. For example:
What is changed and how it works?
Redirect logs to log file. If it's not given, will save log to
./logs/tidb-lightning-timestamp.log
. Only print necessary error message in console.The testing result is:
Check List
Tests
Related changes