Forum Discussion

MegO's avatar
MegO
Contributor
6 years ago

Scripting access to log messages

Hi,

 

I have created a script that writes out tests results to a SQL database. I have got a bit stuck on the last part however. I was hoping to use the general event of on log error to write out the messages to the table.

 

I can easily write messages to the log but how do I pull out the error messages that TestComplete writes to the log. Any help would be greatly appreciated.

 

Regards,

 

MegO

9 Replies

  • MegO's avatar
    MegO
    Contributor

    So I could do something like this:

     

    function GeneralEvents_OnLogError(Sender, LogParams)
    {

    TestComment = LogParams.AdditonalText

    }

     

    and it would return the error logged?

  • MegO's avatar
    MegO
    Contributor

    Yep, Its just not returning anything :(

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      If there is no Additional Info on the log, AdditionalText will be empty.  Hence why there are two different text values on LogParams.  If you want the information in the main log, you want MessageText.  If you want the information that shows in the Additional Info tab, you want AdditionalText.  So, if your log message doesn't have any Additional Info (which is possible), AdditionalText will be empty.