API
Java API
Store Exception
To record exceptions handled by a try-catch block, use RevDeBugAPI.Snapshot.RecordException
and pass the exception object as a parameter. For example:
The recorded snapshot of code execution that led to the exception will be stored on a Recording Server and visible on the RevDeBug DevOps Monitoring dashboard in the same manner unhandled exceptions are.
To use a store exception, you must provide the exception object to be recorded by RevDeBug as arguments of the StoreException function and select one of the two exception types as the second argument:
CatchStateType.EXCEPTION
- This is the normal type of exceptionCatchStateType.LOG_ERROR
- the exception will be marked in the exception table as a log error
Store Snapshot
RevDeBug offers the possibility to create code recordings even when there is no exception. To use the function you should call the function anywhere in the program code. The place in the code where we used the snapshot function will be the end of the recording.
Enable/Disable Recording From API
You can deactivate and activate the RevDeBug flight recorder at any time from the API.
To deactivate the flight recorder:
To activate the flight recorder:
To check if RevDeBug flight recorder is running or not:
Clear Thread Data
If you do not want to record a section of the code, all you have to do is use the ClearThreadData()
function in the code, which will erase the current recording buffer. The code recording will start over from where ClearThreadData()
is used.
Set Maximum Recording Length
You can set the maximum length of the recording (the default is 1000). To do this via api use:
The length of the recording is the number of application states that will be recorded, such as: variable values, values returned by methods, etc.
Trace ID in logs
In Java Agent if you want to get the trace ID in the logs of your application then you need to add the following dependency to pom.xml:
In the logback.xml file, which is a sample file and contains the log template, you must add the layout with a specific class org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout
and pattern with [%X{tid}]
. Sample implementation here:
Last updated