sdahiya's avatar
sdahiya
Occasional Contributor
9 years ago
Status:
New Idea

Store/Save the Log results to a different location

It would be great to store the Log results to a different location instead of default Log location provided by Testcomplete.
Please add this feature so that it is possible to change the custom Log location using script.

7 Comments

  • Hi there,

     

    Not sure why you need a new feature for this? You can try using aqFile.Move(). 

     

    We keep the log file as is and then simply export it to a central location like this for example:

     

    var outFileName;
    var filename = aqConvert.DateTimeToFormatStr(aqDateTime.Now(),"%Y%m%d_%H%M");
    
    Log.Event("Converting output to mht...");
    outFileName = Project.ConfigPath + "Log\\" + filename + ".mht";
    Log.Message(outFileName);
    Log.SaveResultsAs(outFileName, 2); //converts output to mht
    
    if(aqFile.Exists("q:\\automation\\run_output\\" + filename + ".mht")){
    aqFile.Delete("q:\\automation\\run_output\\" + filename + ".mht");
    }
    
    //Copy the file elsewhere
    if(aqFile.Move(outFileName, "q:\\automation\\run_output\\" + filename + ".mht")){
    Log.Message("File moved");
    } else {
    Log.Warning("File was not moved!");
    }

     

    Hope this helps somewhat

  • sdahiya's avatar
    sdahiya
    Occasional Contributor

    Hi,

     

    Thanks for your answer. Yes, this could be one option as an alternative

    but in this case, i must use this custom method in the end of execution of all testcases or test modules.

     

    and I would like to avoid it.

    So it will always better once you setup the custom path in the begining of test execution.

     

    Regards,

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    You can change the log path in Tools > Current Project Properties > General > Log location. Is this what you need?

     

    log-location.png

  • sdahiya's avatar
    sdahiya
    Occasional Contributor

    Hi,

     

    No, this is not what I am looking for!

    Actually I want to set the log location 'path' during run time instead of setting it in the Project settings.

     

  • We use an environment variable in our log path

     

    \\NetworkPath\TestCompleteLogs\%COMPUTERNAME%

     

    This ensures that we have a centralized network dir. Maybe this is something you can use? You can set environment variables during runtime, which will automatically change the log directory.

     

    On the other hand, I think that TestComplete should also enable to set the log dir via Options.LogPath or something.

  • st-pat's avatar
    st-pat
    Occasional Contributor

    sorry for warming up this old thread but the thing that HKosova wrote would exactly fit my needs, unfortunately it seems this setting way is gone in ReadyAPI 2.3 or I'm just too dumb to find it ;)