EventSchemaTraceListener.MaximumNumberOfFiles 属性


获取日志文件最大数。Gets the maximum number of log files.

 property int MaximumNumberOfFiles { int get(); };
public int MaximumNumberOfFiles { get; }
member this.MaximumNumberOfFiles : int
Public ReadOnly Property MaximumNumberOfFiles As Integer


日志文件最大数是由文件的 TraceLogRetentionOption 属性的值来确定。The maximum number of log files, determined by the value of the TraceLogRetentionOption property for the file.


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

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


属性值由构造函数中的maximumNumberOfFiles参数或配置文件中的maximumNumberOfFiles属性设置。The property value is set by the maximumNumberOfFiles parameter in the constructor or the maximumNumberOfFiles attribute in the configuration file.

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

TraceLogRetentionOptionTraceLogRetentionOption 最大文件数Maximum number of files 默认文件数Default number of files
LimitedCircularFiles 不可用N/A 11
LimitedSequentialFiles 不可用N/A 11
SingleFileBoundedSize 不可用N/A -1-1
SingleFileUnboundedSize >0>0 11
UnlimitedSequentialFiles >1>1 22