2 weeks ago
- last edited
2 weeks ago
by
JackLacava
I am debugging some business rules. I would like to add a Console.WriteLine, but I am not sure where that gets written to. I would like to avoid clogging up "Error Logs" and a simple MsgBox is not enough.
Any suggestions on where to look?
Thank you.
2 weeks ago
Hello Ray,
I also find multiple Error Log entries difficult to navigate for debugging purposes.
What I do is declare a class variable that I write all of my log information to from all of the functions and then do a single write to the error log to see the results of the execution. I also add the same BRApi.ErrorLog.LogMessage() statement to the "Catch" clause.
Public log As New Text.StringBuilder
Try
some BR for-loop
log.appendline( "message")
end loop
BRApi.ErrorLog.LogMessage(si, log.ToString)
Catch ex As Exception
' In case of execution error see what has collected in the log so far.
BRApi.ErrorLog.LogMessage(si, log.ToString)
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
2 weeks ago
To see any logged messaged, you need to have access to the 'System' tab. From there you can find the information in the System>Logging>Error Log. One quick note... make sure you remember to remove any error logging after testing is complete so there is not a performance issues.
Below is the method used:
brapi.ErrorLog.LogMessage(si, "I am logging a message")
2 weeks ago
If you're debugging a finance rule or member formula, be sure to use the api equivalent, api.logmessage.