LogPolicy Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Representa a política associada a um LogStore.
public ref class LogPolicy sealed
public sealed class LogPolicy
type LogPolicy = class
Public NotInheritable Class LogPolicy
- Herança
-
LogPolicy
Exemplos
Este exemplo mostra como usar a LogPolicy classe para definir uma política para uma sequência de registos de log.
// 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
'
Observações
Uma política é um conjunto de regras a serem seguidas por uma LogStore instância e pelos seus clientes. Uma LogPolicy instância é usada para examinar e modificar a política associada a um determinado LogStore. Uma política pode descrever os tamanhos mínimos e máximos de logarítmica permitidos, ou como a LogStore instância pode crescer. Além disso, também pode controlar se uma LogStore instância pode ser arquivada.
Após alterar qualquer uma das propriedades, deve usar o Commit método para garantir que as alterações são aplicadas ao LogStore. Pode chamar o Refresh método para descartar alterações ou para obter a apólice mais recente.
Propriedades
| Name | Description |
|---|---|
| AutoGrow |
Recebe ou define um valor que indica se pode LogStore crescer automaticamente. |
| AutoShrinkPercentage |
Obtém ou define a percentagem de espaço livre que LogStore pode encolher. |
| GrowthRate |
Obtém ou define a taxa de crescimento automático do LogStore. |
| MaximumExtentCount |
Obtém ou define o número máximo de LogExtent instâncias que LogStore pode conter. |
| MinimumExtentCount |
Obtém ou define o número mínimo de LogExtent instâncias que LogStore podem conter. |
| NewExtentPrefix |
Recebe ou define a cadeia de prefixos para extensões criadas automaticamente. |
| NextExtentSuffix |
Obtém ou define o número do sufixo para novas extensões. |
| PinnedTailThreshold |
Obtém ou define a quantidade de espaço que o TailPinned evento requer para avançar a base do log. |
Métodos
| Name | Description |
|---|---|
| Commit() |
Define esta política como a política atual para o LogStore. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| Refresh() |
Lê a política atual para o LogStore, descartando quaisquer alterações que possam ter sido feitas. |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |