Is there a way to implement a sliding exit from the network using the standard configuration of the .NET tracer (as opposed to a single massive file)

I am using the .NET configuration .net to create a trace listener to output debugging and tracing in a .NET web application.

The problem is that if you leave a log file that always uses the same name, it can become massive and actually caused some problems with applications today.

I cannot find a way on the network to set a log file size limit or a method for using a dynamic name, for example one that uses a date string as part of the name.

Does anyone know if this is possible?

So far I am using:

<system.diagnostics>
        <trace autoflush="true" indentsize="4">
            <listeners>
                <add name="CollectionLister" type="System.Diagnostics.TextWriterTraceListener" initializeData="Collections.log" />
            </listeners>
        </trace>
    </system.diagnostics>
+3
4

, nlog

.

+3

. Apache log4net

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
    <file value="log.txt" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="100KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] 
            %-5level %logger [%property{NDC}] - %message%newline" />
    </layout>
</appender>
0

Codeplex , , .NET Trace, . .

.

. essentialdiagnostics.

0

Source: https://habr.com/ru/post/1756714/


All Articles