diff --git a/cmd/sealos/cmd/root.go b/cmd/sealos/cmd/root.go index 331503585f9..ef3d7a07874 100644 --- a/cmd/sealos/cmd/root.go +++ b/cmd/sealos/cmd/root.go @@ -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 @@ -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) } }