Microsoft Distributed cache appfabric (velocity)-Development (iii) cache logs

Source: Internet
Author: User

Velocity provides detailed logs. The lifecycle and access records of the cache in the cluster can be recorded.

InCodeTo Enable Logging

 Using System; Using System. Collections. Generic; Using System. LINQ; Using System. text; // Add? ? Null? Between?  Using Microsoft. Data. caching; Using System. diagnostics; Namespace Volocitydemo { Class Log {datacachefactory factory; Public Log () {factory = New Datacachefactory ();}~ Log (){ // Factory. Dispose (); } Public   Void Test (){ // Create a list for the desired log sinks List <datacachelogsink> sinklist = New List <datacachelogsink> (2 ); // Create file-based Log sink, capture warnings and errors Datacachelogsink filebasedsink = New Datacachelogsink (datacachesinktype. File, tracelevel. verbose ," Dcache/yyyy-mm-dd "); // Create console-based Log sink, capture warnings and errors Datacachelogsink consolebasedsink = New Datacachelogsink (datacachesinktype. Console, tracelevel. verbose ); // Add the log sinks to the sink list Sinklist. Add (filebasedsink); sinklist. Add (lelebasedsink ); // Enable the sinks Datacachefactory. createlogsinks (sinklist );}}}

After logging is enabled, you can view detailed logs on the command console (in this example, set the tracelevel attribute to verbose and record all logs ).

At the same time in the ApplicationProgramYou can see the recorded text logs in the directory. Name in this life-saving is: DCache2011-08-19.log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.