←Select platform

Trace Property

Summary

Trace source associated with FileCache.

Syntax
C#
VB
C++
public static TraceSource Trace { get; } 
Public Shared ReadOnly Property Trace() As TraceSource 
   Get 
public:  
   static property TraceSource^ Trace 
   { 
      TraceSource^ get() 
   } 

Property Value

The trace source associated with all instances of FileCache.

Remarks

FileCache initializes Trace as follows:

C#
Trace = new TraceSource(typeof(FileCache).FullName); 

All operations performed by FileCache are then logged into this trace source. This is performed by calling Trace.TraceEvent with the name of the operation and the item's key and region names. For instance, AddOrGetExisting will log the following standard .NET tracing:

C#
Trace.TraceEvent(TraceEventType.Verbose, 1, "Set {0}.{1}", item.RegionName, item.Key); 

The user can enable tracing in FileCache using the following:

C#
// Create a disk file listener 
string logFile = @"c:\log.txt"; 
TextWriterTraceListener trace = new TextWriterTraceListener(outFile); 
trace.Name = "console"; 
// Add it to the FileCache trace listeners 
Leadtools.Caching.FileCache.Trace.Listeners.Remove("Default"); 
Leadtools.Caching.FileCache.Trace.Listeners.Add(trace); 
// Log everything 
Leadtools.Caching.FileCache.Trace.Switch.Level = SourceLevels.All; 
 
// Now use FileCache 
FileCache fileCache = new FileCache(); 
// Use it ... 
 
// Finally, stop tracing 
trace.Flush(); 
Leadtools.Caching.FileCache.Trace.Listeners.Remove(trace); 
trace.Dispose(); 

Requirements

Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Caching Assembly