EventSchemaTraceListener.MaximumFileSize 属性

定义

获取日志文件的最大大小。Gets the maximum size of the log file.

public:
 property long MaximumFileSize { long get(); };
public long MaximumFileSize { get; }
member this.MaximumFileSize : int64
Public ReadOnly Property MaximumFileSize As Long

属性值

最大文件大小(以字节为单位)。The maximum file size, in bytes.

示例

下面的代码示例演示如何显示MaximumFileSize属性的值。The following code example demonstrates how to display the value of the MaximumFileSize property. 此代码示例是为EventSchemaTraceListener类提供的更大示例的一部分。This code example is part of a larger example that is provided for the EventSchemaTraceListener class.

Console.WriteLine("MaximumFileSize =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).MaximumFileSize);
Console.WriteLine("MaximumFileSize =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).MaximumFileSize.ToString())

注解

属性值由构造函数中的maximumFileSize参数或配置文件中的maximumFileSize属性设置。The property value is set by the maximumFileSize parameter in the constructor or the maximumFileSize attribute in the configuration file. 出于性能原因, 应将最大文件大小设置为1024字节的倍数。For performance reasons, you should set the maximum file size to a multiple of 1024 bytes. MaximumFileSize属性值不是绝对值; 它是一个可超出最后一条消息大小的阈值。The MaximumFileSize property value is not an absolute; it is a threshold that can be exceeded up to the size of the last message.

下表显示与每个跟踪日志保留选项关联的文件大小的可能值和默认值。The following table shows the possible and default values for file size that are associated with each trace log retention option. 标记为 "N/A" 的值表示MaximumFileSize不检查TraceLogRetentionOption该属性的值。The values marked as N/A indicate that the MaximumFileSize property is not checked for that TraceLogRetentionOption value.

TraceLogRetentionOptionTraceLogRetentionOption 最大文件大小Maximum file size 默认文件大小Default file size
LimitedCircularFiles 不可用N/A -1-1
LimitedSequentialFiles >0>0 4 KB4 KB
SingleFileBoundedSize >0>0 4 KB4 KB
SingleFileUnboundedSize >0>0 4 KB4 KB
UnlimitedSequentialFiles >0>0 4 KB4 KB

适用于