How to: Set Log Sink Levels (Code) (Velocity)

05/24/2009

On the server side, log sinks can only be configured in the cache host configuration file. For more information about these settings, see Log Sink Settings (Velocity).

To programmatically enable log sinks on the cache client, use the DataCacheFactory class static methods CreateLogSinks or EnableAllAvailableSinks. To disable log sinks programmatically, use the DisableLogSinks static method. For more information about log sink settings, see Log Sink Settings (Velocity).

Note 
These procedures assume that you have already prepared your development environment and set references to the "Velocity" assemblies, and so on. For more information, see How to: Prepare the Development Environment (Velocity)

To create log sinks programmatically on the cache client
Create a list of type DataCacheLogSink to contain the log sinks you want to enable.

Create a DataCacheLogSink object for each log sink you want to enable.

Specify the type of log sink you want by using the DataCacheSinkType enumeration in the sinkType parameter of the DataCacheLogSink constructor.

Specify the trace level of the log sink by using the System.Diagnostics.TraceLevel enumeration in the logLevel parameter of the DataCacheLogSink constructor.

(optional) If you are creating a file-based log sink, and you want to change the log file naming convention and storage location, define the log file naming convention with the sinkParam parameter of the DataCacheLogSink constructor. For more information about the file naming convention, see Log Sink Settings (Velocity).

Add each log sink that you created to the list you created in the first step.

Pass the list of log sinks to the sinkList parameter of the CreateLogSinks method to enable the log sinks on your cache client.

To enable all available log sinks programmatically on the cache client
Call the EnableAllAvailableSinks static method to enable the log sinks on your cache client.

To disable all log sinks programmatically on the cache client
Call the DisableLogSinks static method to enable the log sinks on your cache client.

Posted in: .Net Programming| Tags: .net 4.0 CTP CTP 3 Microsoft Velocity cache code set use sink settings log information levels

Hot Posts

Latest posts

Tags

Others

Sponsors