<trace enabled="true" localOnly="true"/>
For tracing to work it has to be enabled and for it to work only on debug mode the localOnly attribute should be set to 'true'
If you want to set additional parameters.
<trace enabled="true" pageOutput="true" requestLimit="4000" traceMode="SortByCategory" writeToDiagnosticsTrace="true" localOnly="true"/>
pageOutput attribute lets you see the output at the bottom of the page.
For more information visit https://msdn.microsoft.com/en-gb/library/6915t83k(v=vs.85).aspx
And how to use it in the code
#If DEBUG Then
CType(HttpContext.Current.Handler, Page).Trace.Write("Test - Cache
hit")
#End If