diff --git a/api/geth_backend.go b/api/geth_backend.go index 62b5c45c31f..875f24ad6c5 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -205,6 +205,7 @@ func (b *GethStatusBackend) startNodeWithKey(acc multiaccounts.Account, password if err != nil { return err } + if err := logutils.OverrideRootLogWithConfig(conf, false); err != nil { return err } @@ -372,6 +373,15 @@ func (b *GethStatusBackend) loadNodeConfig() (*params.NodeConfig, error) { // which is set at the compile time. // What's cached is usually outdated so we overwrite it here. conf.Version = params.Version + conf.DataDir = filepath.Join(b.rootDataDir, conf.DataDir) + conf.ShhextConfig.BackupDisabledDataDir = filepath.Join(b.rootDataDir, conf.ShhextConfig.BackupDisabledDataDir) + if len(conf.LogDir) == 0 { + conf.LogFile = filepath.Join(b.rootDataDir, conf.LogFile) + } else { + conf.LogFile = filepath.Join(conf.LogDir, conf.LogFile) + } + conf.KeyStoreDir = filepath.Join(b.rootDataDir, conf.KeyStoreDir) + return &conf, nil } diff --git a/api/nimbus_backend.go b/api/nimbus_backend.go index 611b645b5a4..ed3cda16dbe 100644 --- a/api/nimbus_backend.go +++ b/api/nimbus_backend.go @@ -366,6 +366,17 @@ func (b *nimbusStatusBackend) loadNodeConfig() (*params.NodeConfig, error) { // which is set at the compile time. // What's cached is usually outdated so we overwrite it here. conf.Version = params.Version + + // Replace all relative paths with absolute + conf.DataDir = filepath.Join(b.rootDataDir, conf.DataDir) + conf.ShhextConfig.BackupDisabledDataDir = filepath.Join(b.rootDataDir, conf.ShhextConfig.BackupDisabledDataDir) + if len(conf.LogDir) == 0 { + conf.LogFile = filepath.Join(b.rootDataDir, conf.LogFile) + } else { + conf.LogFile = filepath.Join(conf.LogDir, conf.LogFile) + } + conf.KeyStoreDir = filepath.Join(b.rootDataDir, conf.KeyStoreDir) + return &conf, nil } diff --git a/params/config.go b/params/config.go index bcd15885317..0e4c35bd4a7 100644 --- a/params/config.go +++ b/params/config.go @@ -386,6 +386,9 @@ type NodeConfig struct { // LogMobileSystem enables log redirection to android/ios system logger. LogMobileSystem bool + // LogFile is a folder which contains LogFile + LogDir string + // LogFile is filename where exposed logs get written to LogFile string