Skip to content

Commit

Permalink
start: fix missing log on tt start error
Browse files Browse the repository at this point in the history
tt start does not create the log file or print anything in case of
permissions denied errors for runtime and data directories. Create
the logger before any other actions and log error messages.
  • Loading branch information
psergee committed Apr 11, 2024
1 parent 811b898 commit 3229454
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/running/running.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,13 @@ func FillCtx(cliOpts *config.CliOpts, cmdCtx *cmdcontext.CmdCtx,

// Start an Instance.
func Start(cmdCtx *cmdcontext.CmdCtx, inst *InstanceCtx, integrityCheckPeriod time.Duration) error {
logger := createLogger(inst)
logger.Print("[INFO] Start") // Create a log file before any other actions.
if err := createInstanceDataDirectories(*inst); err != nil {
logger.Printf("[ERROR] failed to create a directory: %s", err)
return err
}

logger := createLogger(inst)
provider := providerImpl{cmdCtx: cmdCtx, instanceCtx: inst}
preStartAction := func() error {
if err := process_utils.CreatePIDFile(inst.PIDFile); err != nil {
Expand Down

0 comments on commit 3229454

Please sign in to comment.