Skip to content

Commit

Permalink
fix: setup logger after setting runtimeRootDir (#3793) (#3795)
Browse files Browse the repository at this point in the history
Co-authored-by: fengxsong <fengxsong@outlook.com>
  • Loading branch information
sealos-ci-robot and fengxsong authored Aug 30, 2023
1 parent 9067cec commit 68a9aa6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/sealos/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ func setRequireBuildahAnnotation(cmd *cobra.Command) {
}

func onBootOnDie() {
logger.CfgConsoleAndFileLogger(debug, constants.LogPath(), "sealos", false)
sreglog.CfgConsoleAndFileLogger(debug, constants.LogPath(), "sealos", false)
val, err := system.Get(system.DataRootConfigKey)
errExit(err)
constants.DefaultClusterRootFsDir = val
Expand All @@ -122,11 +120,14 @@ func onBootOnDie() {
constants.Workdir(),
}
errExit(file.MkDirs(rootDirs...))

logger.CfgConsoleAndFileLogger(debug, constants.LogPath(), "sealos", false)
sreglog.CfgConsoleAndFileLogger(debug, constants.LogPath(), "sealos", false)
}

func errExit(err error) {
if err != nil {
logger.Error(err)
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Expand Down

0 comments on commit 68a9aa6

Please sign in to comment.