09-19-2023 08:29 AM - last edited on 09-21-2023 04:52 AM 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.
09-19-2023 09:21 AM
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
09-19-2023 11:58 AM
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")
09-19-2023 02:19 PM
If you're debugging a finance rule or member formula, be sure to use the api equivalent, api.logmessage.