I am working on an approach to the tracing protocol for my company’s project. The VB.NET..NET Framework has fairly universal tracing capabilities, and I would like to use what .NET already provides. My company wants to stay away from third-party software, which is why log4net is out of the question.
They want to be able to track the flow of the web application, and using trace sources, listeners, and switches will make this part pretty easy. However, they want me to keep track of when variables are changing throughout the program, without taking into account each Trace.Write trace ("i =" and i).
So, are there any effective approaches for this?
Your answers are welcome. Thanks in advance.
I decided to go with the class. I just created a TraceVariable Class in which there was an IntegerChanged event. Thus, developers of other parts of the code will be able to control how to handle the change of a variable if it wants to do something other than tracking.
Here is the code:
Public Class TraceVariable
Private mInteger As Integer
Public Event IntegerChanged(ByVal mInteger As Integer)
Public Property TraceInteger() As Integer
Get
TraceInteger = mInteger
End Get
Set(ByVal value As Integer)
mInteger = value
RaiseEvent IntegerChanged(mInteger)
End Set
End Property
End Class
Thanks for answers! Regarding the fact that this is random, we will use it only for critical variables, so do not worry. Tracking in our situation is a necessity and precaution.
source
share