0
我正在使用XQuiSoft.Logging來記錄我的應用程序中的錯誤。 在web.config中,我可以設置日誌文件的大小,路徑和級別。但是我不知道如何設置日誌文件的備份數量。例如,我只想同時保存2個日誌文件。當日志文件達到大小限制時,將創建一個新的日誌文件。新日誌文件達到大小限制後,應自動刪除第一個日誌文件,並生成另一個日誌文件。 任何輸入將不勝感激。XQuiSoft.Logging attributes
<configuration>
<configSections>
<sectionGroup name="XQuiSoft.Logging">
<section name="Log"
type="XQuiSoft.Logging.LogConfiguration, XQuiSoft.Logging"/>
<section name="FilterManager"
type="XQuiSoft.Logging.FilterConfiguration, XQuiSoft.Logging"/>
</sectionGroup>
</configSections>
<appSettings>
<add key="CurrentEnvironment" value="Build"/>
</appSettings>
<XQuiSoft.Logging>
<Log>
<providers>
<add name="Build"
type="XQuiSoft.Logging.BufferedLogProvider, XQuiSoft.Logging"
TargetProviderNames="FileLogger-Build"
OutputInterval="2"
ExclusiveEnvironmentName="Build"
ExceptionProviderName="null"/>
<add name="FileLogger-Build"
type="XQuiSoft.Logging.RollingFileLogProvider, XQuiSoft.Logging"
FilePath="D:\Logs\Build\log"
Extension=".txt"
MaximumFileSize="10MB"
ActiveRoot="false"
ExceptionProviderName="null"
ItemFormat="{Timestamp:yyyyMMdd:HHmmss}: {Level}: {Source}: {Category}: {Message}: {Details}"
FilterName="Verbose"/>
</providers>
</Log>
<FilterManager>
<providers>
<add name="Verbose"
type="XQuiSoft.Logging.LevelFilter, XQuiSoft.Logging"
MaxLevel="Verbose"/>
<add name="ErrorsAndWarnings"
type="XQuiSoft.Logging.LevelFilter, XQuiSoft.Logging"
MaxLevel="Warning"/>
</providers>
</FilterManager>
</XQuiSoft.Logging>
我發現添加屬性MaximumFileCount可以限制日誌文件的數量。 – Fei