Forum Discussion

pradeepdli's avatar
pradeepdli
Occasional Contributor
9 years ago

If there any option to deleting Log Files

Hi friends 

 

Each and every time run the test script huge memory  using store log files . I want to be deteting the stored log file after the successfully runing sript . Pleas provide the solution for it.....

 

Thanks 

5 Replies

  • Hi,

     

    You can use the below code.

     

    function GeneralEvents_OnStopTest(Sender)
    {
        try{
               aqFileSystem.DeleteFolder(Log.Path, true);
        }catch(ex){
              Log.Warning("Error in deleting the logs...!" + ex.description);
        }
    }

     

    However this will leave a <unspecifiec log> entry in the "TestLogs". This is a dangling pointer. This can be removed or this will disppear on closing and reopening the testcomplete.

     

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hi Pradeepdli,

       

      You can consider keeping only a certain number of Test Log, say 10 last reports. For this, you need to activate the Tools | Options | Engines | Log | Number of recent logs to keep option.

       

      In this case, there won't need to delete log files.

    • pradeepdli's avatar
      pradeepdli
      Occasional Contributor

      Hi Ashok 

       

      We tried running the script as instructed by you. But we are getting an error message. The log file which has been highlighted in the screenshot attached, does not exist in our server.

       

      Request you to kindly guide us with your valuable inputs.

       

      Kind regards,

      Pradeep

      • ashokkumareds's avatar
        ashokkumareds
        Contributor

        Hi pradeep,

         

        If you see the delete code aqFileSystem.DeleteFolder(Log.Path, true), it is the path i.e folder itself (\Log\17-07-2015_10_04_09_278) we are deleting with all the subfolders and files. not any specific file.

        I can suggest you to debug this variable "Log.Path" and see if the path is really the path mentioned in the error, And also do you have the permissions for deletion from that location.

         

         

        This is an irrevalent error to the situation, This is coming from different source. Please let me know the outcome. Thanks.

  • Hi Pradeep,

     

    If you get Log files then export into html, then backup with project name or "ViewResultIn IE" from log message panel. the result path shown in Address bar of IE

     

    Manually delete the logs from Logs Panel and Project path. 

     

    Or use "aqFileSystem.DeleteFolder" method

     

    FYI : please refer http://support.smartbear.com/viewarticle/58365/

     

    Thanks,

    Kamal