Setting Transaction ID in Logs
CADP for .NET Core allows you to set transaction IDs for APIs in log entries to enhance the readability of logs. You can set the value of the transaction ID in the TransactionID
property available in the LoggerWrapper
class.
The TransactionID
should be of string type.
Example 1
In the above code, the value of transaction id for NaeSession creation is set to "a1b1c1-a2b2c2"
.
Sample logs
Example 2
In the above code, the value of transaction id for the Encrypt API is set to "a3b3c3-a4b4c4"
.
Sample logs
Note
To remove the existing TransactionID, set the value of TransactionID to
""
orstring.Empty
.Once, a TransactionID is set for any API, the same TransactionID continues to apply to the next APIs if not set explicitly. If you don't want to continue with the same value, either set the TransactionID to any specific value or to
""
orstring.Empty
if TransactionID is not needed.