當前位置: 首頁>>代碼示例>>C#>>正文


C# LogPolicy.NewExtentPrefix屬性代碼示例

本文整理匯總了C#中System.IO.Log.LogPolicy.NewExtentPrefix屬性的典型用法代碼示例。如果您正苦於以下問題:C# LogPolicy.NewExtentPrefix屬性的具體用法?C# LogPolicy.NewExtentPrefix怎麽用?C# LogPolicy.NewExtentPrefix使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在System.IO.Log.LogPolicy的用法示例。


在下文中一共展示了LogPolicy.NewExtentPrefix屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PolicyUnit

// SET LOG POLICY

LogPolicy policy = sequence.LogStore.Policy;

// Set AutoGrow policy. This enables the log to automatically grow
// when the existing extents are full. New extents are added until
// we reach the MaximumExtentCount extents.
// AutoGrow policy is supported only in Windows Vista and not available in R2.

//policy.AutoGrow = true;

// Set the Growth Rate in terms of extents. This policy specifies
// "how much" the log should grow. 
policy.GrowthRate = new PolicyUnit(2, PolicyUnitType.Extents);

// Set the AutoShrink policy. This enables the log to automatically
// shrink if the available free space exceeds the shrink percentage. 
// AutoGrow/shrink policy is supported only in Windows Vista and not available in R2.

//policy.AutoShrinkPercentage = new PolicyUnit(30, PolicyUnitType.Percentage);

// Set the PinnedTailThreshold policy.
// A tail pinned event is triggered when there is no
// log space available and log space may be freed by advancing the base.
// The user must handle the tail pinned event by advancing the base of the log. 
// If the user is not able to move the base of the log, the user should report with exception in
// the tail pinned handler.
// PinnedTailThreashold policy dictates the amount of space that the TailPinned event requests 
// for advancing the base of the log. The amount of space can be in percentage or in terms of bytes 
// which is rounded off to the nearest containers in CLFS. The default is 35 percent.

policy.PinnedTailThreshold = new PolicyUnit(10, PolicyUnitType.Percentage);

// Set the maximum extents the log can have.
policy.MaximumExtentCount = 6;

// Set the minimum extents the log can have.
policy.MinimumExtentCount = 2;

// Set the prefix for new containers that are added. 
// when AutoGrow is enabled.
//policy.NewExtentPrefix = "MyLogPrefix";

// Set the suffix number for new containers that are added.
// when AutoGrow is enabled. 
policy.NextExtentSuffix = 3;

// Commit the log policy.
policy.Commit();

// Refresh updates the IO.Log policy properties with current log policy 
// set in the log. 
policy.Refresh();

// LOG POLICY END
//
開發者ID:.NET開發者,項目名稱:System.IO.Log,代碼行數:56,代碼來源:LogPolicy.NewExtentPrefix


注:本文中的System.IO.Log.LogPolicy.NewExtentPrefix屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。