diff --git a/esp/platform/espp.cpp b/esp/platform/espp.cpp index 18477717f7d..5e61d9627fb 100644 --- a/esp/platform/espp.cpp +++ b/esp/platform/espp.cpp @@ -454,7 +454,8 @@ int init_main(int argc, const char* argv[]) envpt.setown(createPTreeFromXMLFile(cfgfile, ipt_caseInsensitive)); // NB: esp has no standard component config in bare-metal, this is loading defaultYaml only - espConfig.setown(loadConfiguration(defaultYaml, argv, "esp", "ESP", nullptr, nullptr)); + // disable initTracing here, it will be called explicitly below after global config is replaced + espConfig.setown(loadConfiguration(defaultYaml, argv, "esp", "ESP", nullptr, nullptr, nullptr, true, false)); // legacy esp.xml will contain a generated global section if present in the environment. // replace the empty stub created by loadConfiguration with this environment globals section. @@ -464,6 +465,7 @@ int init_main(int argc, const char* argv[]) Owned currentConfig = getComponentConfig(); replaceComponentConfig(currentConfig, global); } + initTraceManager("esp", getComponentConfigSP(), getGlobalConfigSP()); } Owned procpt = NULL; if (envpt) diff --git a/initfiles/componentfiles/configxml/esp.xsl b/initfiles/componentfiles/configxml/esp.xsl index 5be41c5e960..9ee75f15727 100644 --- a/initfiles/componentfiles/configxml/esp.xsl +++ b/initfiles/componentfiles/configxml/esp.xsl @@ -70,14 +70,6 @@ - - - - - - - - @@ -86,6 +78,14 @@ + + + + + + + + diff --git a/system/jlib/jptree.cpp b/system/jlib/jptree.cpp index 994d916f422..1adf011e7de 100644 --- a/system/jlib/jptree.cpp +++ b/system/jlib/jptree.cpp @@ -9037,7 +9037,7 @@ static std::tuple doLoadConfigura return std::make_tuple(std::string(absConfigFilename.str()), newComponentConfig.getClear(), newGlobalConfig.getClear()); } -jlib_decl IPropertyTree * loadConfiguration(IPropertyTree *componentDefault, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor) +jlib_decl IPropertyTree * loadConfiguration(IPropertyTree *componentDefault, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor, bool initTracing) { assertex(configFileUpdater); // NB: loadConfiguration should always be called after configFileUpdater is initialized if (configFileUpdater->isInitialized()) @@ -9066,12 +9066,12 @@ jlib_decl IPropertyTree * loadConfiguration(IPropertyTree *componentDefault, con configFileUpdater->init(std::get<0>(result).c_str(), componentDefault, argv, componentTag, envPrefix, legacyFilename, mapper, altNameAttribute); if (monitor) configFileUpdater->startMonitoring(); - - initTraceManager(componentTag, componentConfiguration.get(), globalConfiguration.get()); + if (initTracing) + initTraceManager(componentTag, componentConfiguration.get(), globalConfiguration.get()); return componentConfiguration.getLink(); } -jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor) +jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor, bool initTracing) { if (componentConfiguration) throw makeStringExceptionV(99, "Configuration for component %s has already been initialised", componentTag); @@ -9087,7 +9087,7 @@ jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char else componentDefault.setown(createPTree(componentTag)); - return loadConfiguration(componentDefault, argv, componentTag, envPrefix, legacyFilename, mapper, altNameAttribute, monitor); + return loadConfiguration(componentDefault, argv, componentTag, envPrefix, legacyFilename, mapper, altNameAttribute, monitor, initTracing); } void replaceComponentConfig(IPropertyTree *newComponentConfig, IPropertyTree *newGlobalConfig) diff --git a/system/jlib/jptree.hpp b/system/jlib/jptree.hpp index e52db5eec1a..35e74a9e07f 100644 --- a/system/jlib/jptree.hpp +++ b/system/jlib/jptree.hpp @@ -317,8 +317,8 @@ inline static bool isValidXPathChr(char c) jlib_decl void mergeConfiguration(IPropertyTree & target, const IPropertyTree & source, const char *altNameAttribute=nullptr, bool overwriteAttr=true); jlib_decl IPropertyTree * loadArgsIntoConfiguration(IPropertyTree *config, const char * * argv, std::initializer_list ignoreOptions = {}); -jlib_decl IPropertyTree * loadConfiguration(IPropertyTree * defaultConfig, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true); -jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true); +jlib_decl IPropertyTree * loadConfiguration(IPropertyTree * defaultConfig, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true, bool initTracing=true); +jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true, bool initTracing=true); jlib_decl void replaceComponentConfig(IPropertyTree *newComponentConfig, IPropertyTree *newGlobalConfig); jlib_decl void initNullConfiguration(); jlib_decl IPropertyTree * getCostsConfiguration();