Forum Discussion

howie_'s avatar
howie_
Contributor
10 years ago

Clarification of how to suppress error logging

Hey Everyone, 



I'm trying to perform an action that occassionally throws an error that I want to prevent from being logged.  I've created an OnLogError handler, and can identify the event causing the error as per 

this thread, but I'm not sure how to impliment Log.LockEvents(). 






function GeneralEvents_OnLogError(Sender, LogParams)


{


       if(aqString.Find(LogParams.AdditionalText, "offendingObjectName") != -1)


       {


              //do something important here


       }  


}





I suspect that Log.LockEvents belongs in the body of the 'if' statement, but if that's the case, when am I supposed to unlock?

1 Reply

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    hi 



    log.LockEvents() only locks the events being posted in TestLog. To handle specfic error u can use something lik this in  onlogerror event






    Sub GeneralEvents_OnLogError(Sender, LogParams)

      If (LogParams.MessageText = "Object not found") then 

        ' It is an expected error.  'handle error here

        ' Perform actions that handle this error in the special way

      else

         'do operation

      End If

    End Sub



    See for more



    u can also disble log being posted using

      Log.enable=False in event handler



    To handle errors in scripts see for more info