LogPolicy Třída

Definice

Představuje zásadu přidruženou k objektu LogStore.

public ref class LogPolicy sealed
public sealed class LogPolicy
type LogPolicy = class
Public NotInheritable Class LogPolicy
Dědičnost
LogPolicy

Příklady

Tento příklad ukazuje, jak použít LogPolicy třídu k nastavení zásad pro posloupnost záznamů protokolu.

// 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
//
' SET LOG POLICY

Dim policy As LogPolicy = 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
'

Poznámky

Zásada je sada pravidel, která LogStore se má řídit instancí a jejími klienty. Instance LogPolicy se používá ke kontrole a úpravě zásad přidružených ke konkrétnímu LogStoreobjektu . Zásady můžou popisovat minimální a maximální povolené velikosti protokolů nebo způsob, jakým LogStore se instance může zvětšovat. Kromě toho můžete také řídit, jestli LogStore je možné instanci archivovat.

Po změně některé z vlastností byste měli použít metodu Commit , abyste zajistili, že se změny použijí na LogStore. Můžete volat metodu Refresh , která zahodí změny nebo získáte nejaktuálnější zásady.

Vlastnosti

AutoGrow

Získá nebo nastaví hodnotu označující, zda LogStore může růst automaticky.

AutoShrinkPercentage

Získá nebo nastaví procento volného místa, které LogStore může zmenšit.

GrowthRate

Získá nebo nastaví rychlost automatického LogStorerůstu .

MaximumExtentCount

Získá nebo nastaví maximální počet LogExtent instancí, které LogStore může obsahovat.

MinimumExtentCount

Získá nebo nastaví minimální počet LogExtent instancí, které LogStore může obsahovat.

NewExtentPrefix

Získá nebo nastaví řetězec předpony pro automaticky vytvořené rozsahy.

NextExtentSuffix

Získá nebo nastaví číslo přípony pro nové rozsahy.

PinnedTailThreshold

Získá nebo nastaví velikost místa, které TailPinned událost vyžaduje pro posun základu protokolu.

Metody

Commit()

Nastaví tuto zásadu jako aktuální zásadu pro .LogStore

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Získá aktuální Type instanci.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
Refresh()

Přečte aktuální zásadu LogStorepro a zahodí všechny změny, které mohly být provedeny.

ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro