如何在 Essential.Diagnostics.RollingFileTraceListener 中设置 maxFileSize

How to set maxFileSize in Essential.Diagnostics.RollingFileTraceListener

谁能告诉我如何在 Essential.Diagnostics.RollingFileTraceListener 中为日志文件设置 MaxSize。这是我的配置

<system.diagnostics>
    <sharedListeners>
      <add name="filelog" type="Essential.Diagnostics.RollingFileTraceListener, Essential.Diagnostics"
           initializeData="C:\Team\LogFiles\{ApplicationName}-{DateTime:MMddyyyy}.log"
           template="[{DateTime:MM-dd-yyyy HH':'mm':'ss}] [{MachineName}] {EventType} {Source} : {Message}{Data}"/>
    </sharedListeners>
    <trace autoflush="true">
      <listeners>
        <clear />
        <add name="filelog" />
      </listeners>
    </trace>
  </system.diagnostics>

你不能。

documentation for RollingFileTraceListener 所述:

A trace listener that writes to a text file, rolling to a new file based on a filename template (usually including the date).

A rolling log file is achieved by including the date in the filename, so that when the date changes a different file is used.

与滚动文件的 log4net 的 RollingFileAppender "based on size or date or both" 不同,此组件仅按日期滚动。

(您也可以 inspect the code 并看到没有与文件大小相关的属性)