Forum Discussion

fujunxu's avatar
fujunxu
Contributor
11 years ago

Problem when using Log.SaveResultsAs

I tried to use Log.SaveResultsAs in my script so when there is erro my script can send the error log through email.  But I found that the result file({72032B8B-B283-4530-B081-E3C3A57B53A1} )for Log.SaveResultsAs is only 6k.  The same result file which generated by TC is 22K.  Looks like when I use Log.SaveResult it only save part of the logs. 

  • Or you can try mhtml format but without pictures in it - it will be much lighter:


    procedure



    ExportExample;



    var



    FileName : OleVariant;



    begin



    FileName := Project.ConfigPath + 'Log\YourFile.mhtml';



    Log.SaveResultsAs(FileName, 0, false);



     


  • I use  this in my GeneralEvents_OnLogError method.


    Log.SaveResultsAs(Project.Path+"\\log\\"+ "LatestResult.xml",0);



    by the way.  I tried to attach the logs  to this post but it said "This type of file cannot be uploaded."



    Thanks for your help.


  • When I saved it in mht format I can get everything in the log.  But usually mht files are too big for my email.  I only want to send the txt part so that is why I choose to use xml format. 
  • Still couldn't solve the problem.  Can someone help ?  Thanks,
  • Hi!



    If you run only this script - log for only this script will be exported, but if you run it during project suite run - you will get all project suit log. Maybe that is the problem?
  • Hi!



    If you run only this script - log for only this script will be exported, but if you run it during project suite run - you will get all project suit log. Maybe that is the problem?
  • Or you can try mhtml format but without pictures in it - it will be much lighter:


    procedure



    ExportExample;



    var



    FileName : OleVariant;



    begin



    FileName := Project.ConfigPath + 'Log\YourFile.mhtml';



    Log.SaveResultsAs(FileName, 0, false);