فهرست منبع

Merge pull request #1120 from RussWhitehead/newlog

FIX: All components to use new logging creator
Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 13 سال پیش
والد
کامیت
6593d474ed

+ 2 - 1
dali/datest/datest.cpp

@@ -2795,7 +2795,8 @@ int main(int argc, char* argv[])
     try {
         StringBuffer cmd;
         splitFilename(argv[0], NULL, NULL, &cmd, NULL);
-        openLogFile(cmd.toLowerCase().append(".log").str());
+        StringBuffer lf;
+        openLogFile(lf, cmd.toLowerCase().append(".log").str());
 
 #if defined(TEST_MEMTHREADS)
         printf("start...\n");

+ 2 - 1
dali/datest/dfuwutest.cpp

@@ -952,7 +952,8 @@ int main(int argc, char* argv[])
 
         StringBuffer cmd;
         splitFilename(argv[0], NULL, NULL, &cmd, NULL);
-        openLogFile(cmd.toLowerCase().append(".log").str());
+        StringBuffer lf;
+        openLogFile(lf, cmd.toLowerCase().append(".log").str());
         PROGLOG("DFUWUTEST Starting");
         SocketEndpoint ep;
         SocketEndpointArray epa;

+ 2 - 1
dali/daunittest/daunittest.cpp

@@ -104,7 +104,8 @@ int main( int argc, char **argv )
     try {
         StringBuffer cmd;
         splitFilename(argv[0], NULL, NULL, &cmd, NULL);
-        openLogFile(cmd.toLowerCase().append(".log").str());
+        StringBuffer lf;
+        openLogFile(lf, cmd.toLowerCase().append(".log").str());
         if (argc<2) {
             usage();
             return 1;

+ 1 - 1
dali/dfu/dfuserver.cpp

@@ -143,7 +143,7 @@ int main(int argc, const char *argv[])
         removeSentinelFile(sentinelFile);
         Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(globals, "dfuserver");
         lf->setMaxDetail(1000);
-        lf->beginLogging();
+        fileMsgHandler = lf->beginLogging();
     }
     StringBuffer ftslogdir;
     if (getConfigurationDirectory(globals->queryPropTree("Directories"),"log","ftslave",globals->queryProp("@name"),ftslogdir)) // NB instance deliberately dfuserver's

+ 2 - 1
dali/regress/daregress.cpp

@@ -668,7 +668,8 @@ int main(int argc, char* argv[])
     try {
         StringBuffer cmd;
         splitFilename(argv[0], NULL, NULL, &cmd, NULL);
-        openLogFile(cmd.toLowerCase().append(".log").str());
+        StringBuffer lf;
+        openLogFile(lf, cmd.toLowerCase().append(".log").str());
         if (argc<2) {
             usage();
             return 1;

+ 4 - 5
dali/server/daserver.cpp

@@ -69,12 +69,10 @@ MODULE_EXIT()
     delete stopServerCrit;
 }
 
-ILogMsgHandler * fileMsgHandler;
-
 #define DEFAULT_PERF_REPORT_DELAY 60
 #define DEFAULT_MOUNT_POINT "/mnt/dalimirror/"
 
-void setMsgLevel(unsigned level)
+void setMsgLevel(ILogMsgHandler * fileMsgHandler, unsigned level)
 {
     ILogMsgFilter *filter = getSwitchLogMsgFilterOwn(getComponentLogMsgFilter(3), getCategoryLogMsgFilter(MSGAUD_all, MSGCLS_all, level, true), getDefaultLogMsgFilter());
     queryLogMsgManager()->changeMonitorFilter(queryStderrLogMsgHandler(), filter);
@@ -170,11 +168,12 @@ int main(int argc, char* argv[])
         if (confIFile->exists())
             serverConfig.setown(createPTreeFromXMLFile(DALICONF));
 
+        ILogMsgHandler * fileMsgHandler;
         {
             Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(serverConfig, "dali");
             lf->setLogDirSubdir("server");//add to tail of config log dir
             lf->setName("DaServer");//override default filename
-            lf->beginLogging();
+            fileMsgHandler = lf->beginLogging();
         }
 
         DBGLOG("Build %s", BUILD_TAG);
@@ -356,7 +355,7 @@ int main(int argc, char* argv[])
         }
         unsigned short myport = epa.item(myrank).port;
         startMPServer(myport,true);
-        setMsgLevel(serverConfig->getPropInt("SDS/@msgLevel", 100));
+        setMsgLevel(fileMsgHandler, serverConfig->getPropInt("SDS/@msgLevel", 100));
         startLogMsgChildReceiver(); 
         startLogMsgParentReceiver();
 

+ 3 - 9
ecl/eclagent/eclagent.cpp

@@ -3062,8 +3062,8 @@ extern int HTHOR_API eclagent_main(int argc, const char *argv[], StringBuffer *
     if (!standAloneExe)
     {
         Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(agentTopology, "eclagent");
-        lf->setCreateAliasFile(false);
         lf->setMsgFields(MSGFIELD_timeDate | MSGFIELD_msgID | MSGFIELD_process | MSGFIELD_thread | MSGFIELD_code);
+        lf->setCreateAliasFile(false);
         lf->beginLogging();
         PROGLOG("Logging to %s", lf->queryLogFileSpec());
         logfilespec.set(lf->queryLogFileSpec());
@@ -3072,14 +3072,8 @@ extern int HTHOR_API eclagent_main(int argc, const char *argv[], StringBuffer *
     {
         StringBuffer exeName;
         splitFilename(argv[0], NULL, NULL, &exeName, NULL);
-
-        Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(".", exeName.toLowerCase());//log to "cwd/exename.log"
-        lf->setLocal(true);
-        lf->setRolling(false);
-        lf->setMsgFields(MSGFIELD_timeDate | MSGFIELD_msgID | MSGFIELD_process | MSGFIELD_thread | MSGFIELD_code);
-        lf->beginLogging();
-        PROGLOG("Logging to %s", lf->queryLogFileSpec());
-        logfilespec.set(lf->queryLogFileSpec());
+        openLogFile(logfilespec, exeName.toLowerCase());
+        PROGLOG("Logging to %s", logfilespec.str());
     }
 
     if (wuXML && wuXML->length())

+ 3 - 2
ecl/eclcc/eclcc.cpp

@@ -376,9 +376,10 @@ void EclCC::loadOptions()
     {
         if (optLogfile.length())
         {
-            openLogFile(optLogfile, optLogDetail, false);
+            StringBuffer lf;
+            openLogFile(lf, optLogfile, optLogDetail, false);
             if (logVerbose)
-                fprintf(stdout, "Logging to '%s'\n",optLogfile.get());
+                fprintf(stdout, "Logging to '%s'\n",lf.str());
         }
     }
 

+ 5 - 10
services/runagent/frunssh.cpp

@@ -53,16 +53,11 @@ int main( int argc, char *argv[] )
     try  {
         StringBuffer logname;
         splitFilename(argv[0], NULL, NULL, &logname, NULL);
-        StringBuffer logdir;
-        if (getConfigurationDirectory(NULL,"log","frunssh",logname.str(),logdir)) {
-            recursiveCreateDirectory(logdir.str());
-            StringBuffer tmp(logname);
-            addPathSepChar(logname.clear().append(logdir)).append(tmp);
-        }
-        addFileTimestamp(logname, true);
-        logname.append(".log");
-        appendLogFile(logname.str(),0,false);
-        queryStderrLogMsgHandler()->setMessageFields(MSGFIELD_prefix);
+
+        Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator("frunssh");
+        lf->setCreateAliasFile(false);
+        lf->setMsgFields(MSGFIELD_prefix);
+        lf->beginLogging();
 
         Owned<IFRunSSH> runssh = createFRunSSH();
         runssh->init(argc,argv);

+ 8 - 0
system/jlib/jfile.cpp

@@ -4785,6 +4785,14 @@ StringBuffer &makeAbsolutePath(const char *relpath,StringBuffer &out)
     return out.append(path);
 }
 
+StringBuffer &makeAbsolutePath(StringBuffer &relpath)
+{
+    StringBuffer out;
+    makeAbsolutePath(relpath.str(),out);
+    relpath.swapWith(out);
+    return relpath;
+}
+
 StringBuffer &makeAbsolutePath(const char *relpath, const char *basedir, StringBuffer &out)
 {
     StringBuffer combined;

+ 1 - 0
system/jlib/jfile.hpp

@@ -535,6 +535,7 @@ inline bool isAbsolutePath(const char *path)
 
 
 extern jlib_decl StringBuffer &makeAbsolutePath(const char *relpath,StringBuffer &out);
+extern jlib_decl StringBuffer &makeAbsolutePath(StringBuffer &relpath);
 extern jlib_decl StringBuffer &makeAbsolutePath(const char *relpath, const char *basedir, StringBuffer &out);
 extern jlib_decl const char *splitRelativePath(const char *full,const char *basedir,StringBuffer &reldir); // removes basedir if matches, returns tail and relative dir
 extern jlib_decl const char *splitDirMultiTail(const char *multipath,StringBuffer &dir,StringBuffer &tail);

+ 74 - 47
system/jlib/jlog.cpp

@@ -967,7 +967,7 @@ void RollingFileLogMsgHandler::doRollover(bool daily, const char *forceName) con
     }
     recursiveCreateDirectoryForFile(filename.str());
     handle = fopen(filename.str(), append ? "a" : "w");
-    if (handle && alias)
+    if (handle && alias && alias.length())
     {
         fclose(handle);
         handle = 0;
@@ -2603,12 +2603,12 @@ private:
     StringBuffer name;
     StringBuffer postfix;
     StringBuffer extension;
+    StringBuffer fullFileSpec;
 
     bool         createAlias;
     StringBuffer aliasName;
 
     StringBuffer logDirSubdir;
-    StringBuffer logFileSpec;
 
     bool         rolling;
 
@@ -2655,76 +2655,98 @@ public:
 
     CComponentLogFileCreator(const char *_logDir, const char *_component) : logDir(_logDir), component(_component)
     {
-        if (!component)
-            throw MakeStringException(3000,"CComponentLogFileCreator:Missing Component Name"); // 3000: internal error
         setDefaults();
     }
 
+    CComponentLogFileCreator(const char *_component) : component(_component)
+    {
+        setDefaults();
+        if (!getConfigurationDirectory(NULL, "log", _component, _component, logDir))
+        {
+            appendCurrentDirectory(logDir,false);
+        }
+    }
 
     //set methods
-    void setExtension(const char * _ext)     { extension.set(_ext); }   //default ".log"
-    void setPrefix(const char * _prefix)     { prefix.set(_prefix); }   //default NULL
-    void setName(const char * _name)         { name.set(_name); }       //default is component name
-    void setPostfix(const char * _postfix)   { postfix.set(_postfix); } //default NULL
-    void setCreateAliasFile(bool _create)    { createAlias = _create; } //controls creation of alias file
-    void setAliasName(const char * _aliasName)   { aliasName.set(_aliasName); }//specify fn without extension
-    void setLogDirSubdir(const char * _subdir)   { logDirSubdir.set(_subdir); }//to be appended to config log dir
-    void setRolling(const bool _rolls)       { rolling = _rolls; }      //daily rollover
+    void setExtension(const char * _ext)     { extension.set(_ext); }
+    void setPrefix(const char * _prefix)     { prefix.set(_prefix); }
+    void setName(const char * _name)         { name.set(_name); }
+    void setCompleteFilespec(const char * _fs){ fullFileSpec.set(_fs); }
+    void setPostfix(const char * _postfix)   { postfix.set(_postfix); }
+    void setCreateAliasFile(bool _create)    { createAlias = _create; }
+    void setAliasName(const char * _aliasName)   { aliasName.set(_aliasName); }
+    void setLogDirSubdir(const char * _subdir)   { logDirSubdir.set(_subdir); }
+    void setRolling(const bool _rolls)       { rolling = _rolls; }
 
     //ILogMsgHandler fields
-    void setAppend(const bool _append)       { append = _append; }      //append to existing file with same name
-    void setFlushes(const bool _flushes)     { flushes = _flushes; }    //automatic flush
-    void setMsgFields(const unsigned _fields){ msgFields = _fields; }   //fields/columns to be included in log
+    void setAppend(const bool _append)       { append = _append; }
+    void setFlushes(const bool _flushes)     { flushes = _flushes; }
+    void setMsgFields(const unsigned _fields){ msgFields = _fields; }
 
     //ILogMsgFilter fields
-    void setMsgAudiences(const unsigned _audiences){ msgAudiences = _audiences; }  //log audience
-    void setMsgClasses(const unsigned _classes)    { msgClasses = _classes; }      //message class
-    void setMaxDetail(const LogMsgDetail _maxDetail)  { maxDetail = _maxDetail; }  //message detail
+    void setMsgAudiences(const unsigned _audiences){ msgAudiences = _audiences; }
+    void setMsgClasses(const unsigned _classes)    { msgClasses = _classes; }
+    void setMaxDetail(const LogMsgDetail _maxDetail)  { maxDetail = _maxDetail; }
     void setLocal(const bool _local)               { local = _local; }
 
     //query methods (not valid until logging started)
-    const char * queryLogDir()          { return logDir.str(); }         //location of log files
-    const char * queryLogFileSpec()     { return expandedLogSpec.str(); }//full filespec of log file
-    const char * queryAliasFileSpec()   { return aliasFileSpec.str(); }  //logfile alias
+    const char * queryLogDir()          { return logDir.str(); }
+    const char * queryLogFileSpec()     { return expandedLogSpec.str(); }
+    const char * queryAliasFileSpec()   { return aliasFileSpec.str(); }
 
-    bool beginLogging()
+    ILogMsgHandler * beginLogging()
     {
         //build directory path
-        if (!logDir.length())
+        StringBuffer logFileSpec;
+        if (!fullFileSpec.length())//user specify complete logfile specification?
         {
-            logDir.append(".").append(PATHSEPSTR).append("logs");
-            WARNLOG("No logfile directory specified - logs will be written locally to %s", logDir.str());
-        }
+            if (!logDir.length())
+            {
+                appendCurrentDirectory(logDir,false).append(PATHSEPSTR).append("logs");
+                WARNLOG("No logfile directory specified - logs will be written locally to %s", logDir.str());
+            }
 
-        //build log file name (without date string or extension)
-        StringBuffer logFileName;
-        if (prefix.length())
-            logFileName.append(prefix).append(".");
-        logFileName.append(name);
-        if (postfix.length())
-            logFileName.append(".").append(postfix);
-
-        //build log file spec
-        if (logDirSubdir.length())
-            logDir.append(PATHSEPCHAR).append(logDirSubdir);//user specified subfolder
-        logFileSpec.append(logDir).append(PATHSEPCHAR).append(logFileName);
-
-        //build alias file spec
-        if (createAlias)
-        {
-            if (aliasName.length()==0)
-                aliasName.set(logFileName);
-            aliasFileSpec.append(logDir).append(PATHSEPCHAR).append(aliasName).append(extension);
+            makeAbsolutePath(logDir);
+
+            //build log file name (without date string or extension)
+            StringBuffer logFileName;
+            if (prefix.length())
+                logFileName.append(prefix).append(".");
+            logFileName.append(name);
+            if (postfix.length())
+                logFileName.append(".").append(postfix);
+
+            //build log file spec
+            if (logDirSubdir.length())
+                logDir.append(PATHSEPCHAR).append(logDirSubdir);//user specified subfolder
+            logFileSpec.append(logDir).append(PATHSEPCHAR).append(logFileName);
+
+            //build alias file spec
+            if (createAlias)
+            {
+                if (aliasName.length()==0)
+                    aliasName.set(logFileName);
+                aliasFileSpec.append(logDir).append(PATHSEPCHAR).append(aliasName).append(extension);
+            }
         }
+        else
+            makeAbsolutePath(fullFileSpec);
 
         ILogMsgHandler * lmh;
         if (rolling)
             lmh = getRollingFileLogMsgHandler(logFileSpec.str(), extension, msgFields, append, flushes, NULL, aliasFileSpec.str(), true);
         else
-            lmh = getFileLogMsgHandler(logFileSpec.append(extension).str(), NULL, msgFields, false);
+        {
+            StringBuffer lfs;
+            if (fullFileSpec.length())
+                lfs.set(fullFileSpec);
+            else
+                lfs.set(logFileSpec.append(extension).str());
+            lmh = getFileLogMsgHandler(lfs.str(), NULL, msgFields, false);
+        }
         lmh->getLogName(expandedLogSpec);
         queryLogMsgManager()->addMonitorOwn( lmh, getCategoryLogMsgFilter(msgAudiences, msgClasses, maxDetail, local));
-        return true;
+        return lmh;
     }
 };
 
@@ -2737,3 +2759,8 @@ IComponentLogFileCreator * createComponentLogFileCreator(const char *_logDir, co
 {
     return new CComponentLogFileCreator(_logDir, _component);
 }
+
+IComponentLogFileCreator * createComponentLogFileCreator(const char *_component)
+{
+    return new CComponentLogFileCreator(_component);
+}

+ 3 - 2
system/jlib/jlog.hpp

@@ -1014,6 +1014,7 @@ interface IComponentLogFileCreator : extends IInterface
     virtual void setAliasName(const char * _aliasName) = 0; //alias file name, overrides default of component name
     virtual void setLogDirSubdir(const char * _subdir) = 0; //subdir be appended to config log dir (eg "server" or "audit")
     virtual void setRolling(const bool _rolls) = 0;         //daily rollover to new file
+    virtual void setCompleteFilespec(const char * _fs) = 0; //Full filespec (path/fn.ext), overrides everything else
 
     //ILogMsgHandler fields
     virtual void setAppend(const bool _append) = 0;         //append to existing logfile
@@ -1031,10 +1032,10 @@ interface IComponentLogFileCreator : extends IInterface
     virtual const char * queryLogFileSpec() = 0;    //Full log filespec
     virtual const char * queryAliasFileSpec() = 0;  //Full alias filespec, if created
 
-    virtual bool beginLogging() = 0;    //begin logging to specified file(s)
+    virtual ILogMsgHandler * beginLogging() = 0;    //begin logging to specified file(s)
 };
 
 extern jlib_decl IComponentLogFileCreator * createComponentLogFileCreator(IPropertyTree * _properties, const char *_component);
 extern jlib_decl IComponentLogFileCreator * createComponentLogFileCreator(const char *_logDir, const char *_component);
-
+extern jlib_decl IComponentLogFileCreator * createComponentLogFileCreator(const char *_component);
 #endif

+ 11 - 30
system/jlib/jmisc.cpp

@@ -199,34 +199,20 @@ jlib_decl ILogIntercept* interceptLog(ILogIntercept *intercept)
     return old;
 }
 
-ILogMsgHandler * theLegacyLogMsgHandler;
-
-//DEPRECATED!  Use jlog "CComponentLogFileCreator"
-jlib_decl void openLogFile(const char *filename, unsigned detail, bool enterQueueMode)
+jlib_decl void openLogFile(StringBuffer & resolvedFS, const char *filename, unsigned detail, bool enterQueueMode, bool append)
 {
     if(enterQueueMode)
         queryLogMsgManager()->enterQueueingMode();
-    if (!detail)
-        detail = DefaultDetail;
-    if(theLegacyLogMsgHandler)
-        queryLogMsgManager()->removeMonitor(theLegacyLogMsgHandler);
-    theLegacyLogMsgHandler = getFileLogMsgHandler(filename, 0, MSGFIELD_PRINTLOG, false, false, true);
-    ILogMsgFilter * filter = getCategoryLogMsgFilter(MSGAUD_all, MSGCLS_all, detail, false);
-    queryLogMsgManager()->addMonitorOwn(theLegacyLogMsgHandler, filter);
-}
-
-//DEPRECATED!  Use jlog "CComponentLogFileCreator"
-jlib_decl void appendLogFile(const char *filename, unsigned detail, bool enterQueueMode)
-{
-    if(enterQueueMode)
-        queryLogMsgManager()->enterQueueingMode();
-    if (!detail)
-        detail = DefaultDetail;
-    if(theLegacyLogMsgHandler)
-        queryLogMsgManager()->removeMonitor(theLegacyLogMsgHandler);
-    theLegacyLogMsgHandler = getFileLogMsgHandler(filename, 0, MSGFIELD_PRINTLOG, false, true, true);
-    ILogMsgFilter * filter = getCategoryLogMsgFilter(MSGAUD_all, MSGCLS_all, detail, false);
-    queryLogMsgManager()->addMonitorOwn(theLegacyLogMsgHandler, filter);
+    Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(".", 0);
+    lf->setCreateAliasFile(false);
+    lf->setLocal(true);
+    lf->setRolling(false);
+    lf->setAppend(append);
+    lf->setCompleteFilespec(filename);//user specified log filespec
+    lf->setMaxDetail(detail ? detail : DefaultDetail);
+    lf->setMsgFields(MSGFIELD_timeDate | MSGFIELD_msgID | MSGFIELD_process | MSGFIELD_thread | MSGFIELD_code);
+    lf->beginLogging();
+    resolvedFS.set(lf->queryLogFileSpec());
 }
 
 jlib_decl void PrintLogDirect(const char *msg)
@@ -251,11 +237,6 @@ jlib_decl void SPrintLog(const char *fmt, ...)
     va_end(args);
 }
 
-ILogMsgHandler * queryLegacyLogMsgHandler()
-{
-    return theLegacyLogMsgHandler;
-}
-
 StringBuffer &addFileTimestamp(StringBuffer &fname, bool daily)
 {
     time_t tNow;

+ 3 - 3
system/jlib/jmisc.hpp

@@ -58,9 +58,9 @@ public:
 };
 jlib_decl ILogIntercept* interceptLog(ILogIntercept *intercept); // for custom tracing
 
-jlib_decl void openLogFile(const char *filename, unsigned detail = 0, bool enterQueueMode = true);
-jlib_decl void appendLogFile(const char *filename, unsigned detail = 0, bool enterQueueMode = true);
-jlib_decl ILogMsgHandler * queryLegacyLogMsgHandler();
+//Use openLogFile() to create/append a simple, local component logfile, providing a filename(or filespec).
+//Typically used to create a non rolling, local logfile in cwd, using default logfile contents
+jlib_decl void openLogFile(StringBuffer & resolvedFS, const char *filename, unsigned detail = 0, bool enterQueueMode = true, bool append = false);
 
 #ifndef DISABLE_PRINTLOG
 jlib_decl void PrintLogDirect(const char *msg);

+ 5 - 10
system/jlib/jutil.cpp

@@ -2242,25 +2242,20 @@ StringBuffer & fillConfigurationDirectoryEntry(const char *dir,const char *name,
 
 IPropertyTree *getHPCCenvironment(const char *confloc)
 {
-    
-    if (!confloc)
+    StringBuffer configFileSpec(confloc);
+    if (!configFileSpec.length())
 #ifdef _WIN32 
         return NULL;
 #else
-    {
-        StringBuffer EnvConfPath(CONFIG_DIR);
-        EnvConfPath.append(PATHSEPSTR).append("environment.conf");
-
-        confloc = EnvConfPath.str();
-    }
+        configFileSpec.set(CONFIG_DIR).append(PATHSEPSTR).append("environment.conf");
 #endif  
-    Owned<IProperties> props = createProperties(confloc);
+    Owned<IProperties> props = createProperties(configFileSpec.str());
     if (props) {
         StringBuffer envfile;
         if (props->getProp("environment",envfile)&&envfile.length()) {
             if (!isAbsolutePath(envfile.str())) {
                 StringBuffer tail(envfile);
-                splitDirTail(confloc,envfile.clear());
+                splitDirTail(configFileSpec.str(),envfile.clear());
                 addPathSepChar(envfile).append(tail);
             }
             Owned<IFile> file = createIFile(envfile.str());

+ 2 - 1
system/mp/test/mptest.cpp

@@ -505,7 +505,8 @@ int main(int argc, char* argv[])
 #endif
     try {
         EnableSEHtoExceptionMapping();
-        openLogFile("c:\\mptest.log");
+        StringBuffer lf;
+        openLogFile(lf, "c:\\mptest.log");
         PrintLog("MPTEST Starting");
 
 #ifndef MYMACHINES

+ 1 - 1
thorlcr/master/thmastermain.cpp

@@ -495,7 +495,7 @@ int main( int argc, char *argv[]  )
             lf->setCreateAliasFile(false);
             lf->setMsgFields(MSGFIELD_timeDate | MSGFIELD_msgID | MSGFIELD_process | MSGFIELD_thread | MSGFIELD_code);
             lf->beginLogging();
-            createUNCFilename(lf->queryAliasFileSpec(), logUrl, false);
+            createUNCFilename(lf->queryLogFileSpec(), logUrl, false);
         }
         LOG(MCdebugProgress, thorJob, "Opened log file %s", logUrl.toCharArray());
         LOG(MCdebugProgress, thorJob, "Build %s", BUILD_TAG);

+ 1 - 1
thorlcr/slave/thslavemain.cpp

@@ -210,7 +210,7 @@ void startSlaveLog()
     lf->beginLogging();
 
     StringBuffer url;
-    createUNCFilename(lf->queryAliasFileSpec(), url);//use alias name
+    createUNCFilename(lf->queryLogFileSpec(), url);
 
     LOG(MCdebugProgress, thorJob, "Opened log file %s", url.toCharArray());
     LOG(MCdebugProgress, thorJob, "Build %s", BUILD_TAG);

+ 3 - 2
thorlcr/thorutil/thormisc.cpp

@@ -575,8 +575,9 @@ void SetLogName(const char *prefix, const char *logdir, const char *thorname, bo
     logname.append(timeStamp);
 #endif
     logname.append(".log");
-    openLogFile(logname.toCharArray());
-    PrintLog("Opened log file %s", logname.toCharArray());
+    StringBuffer lf;
+    openLogFile(lf, logname.toCharArray());
+    PrintLog("Opened log file %s", lf.str());
     PrintLog("Build %s", BUILD_TAG);
 }
 #endif

+ 2 - 1
tools/dumpkey/dumpkey.cpp

@@ -88,7 +88,8 @@ int main(int argc, const char **argv)
     {
         StringBuffer logname("dumpkey.");
         logname.append(GetCachedHostName()).append(".");
-        openLogFile(logname.append("log").str());
+        StringBuffer lf;
+        openLogFile(lf, logname.append("log").str());
         
         Owned <IKeyIndex> index;
         const char * keyName = globals->queryProp("keyfile");

+ 2 - 1
tools/swapnode/swapnode.cpp

@@ -1180,7 +1180,8 @@ int main(int argc,char** argv)
             splitFilename(argv[0], NULL, NULL, &logname, NULL);
             addFileTimestamp(logname, true);
             logname.append(".log");
-            appendLogFile(logname.str(),0,false);
+            StringBuffer lf;
+            openLogFile(lf, logname.str(),0,false,true);
             queryStderrLogMsgHandler()->setMessageFields(MSGFIELD_prefix);
             if (options&&options->getPropBool("@enableSysLog",true))
                 UseSysLogForOperatorMessages();