Skip to content

File not rolling on specifying rollSizeKB but work with RollInterval using EnterpriseLibrary.Logging.NetCore #3

Description

@agupta0111

Log File :
LogWriter logWriter = null;
logWriter = new LogWriterFactory().Create();
for (int i = 0; i <= 5000000; i++)
{
logWriter.Write("First Loop");
logWriter.Write("log" + i);
}
Config file:

<listeners>
  <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null"        
       listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null"
          fileName="RollingFlatFile.log"
          footer="----------------------------------" formatter="Text Formatter"
          header=""
          traceOutputOptions="DateTime, Timestamp" filter="All" rollFileExistsBehavior="Increment" timeStampPattern="yyyy" rollSizeKB="3000" />
</listeners>
<formatters>
  <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  template="Timestamp: {timestamp(local)}  Message: {message}  Category: {category} Priority: {priority}  Severity: {severity}" name="Text Formatter" />
</formatters>
<categorySources>
  <add switchValue="All" autoFlush="true" name="General">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
      <!--<add name="Event Log Trace Listener" />-->
    </listeners>
  </add>
</categorySources>
<specialSources>
  <allEvents switchValue="All" name="All Events">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
  </allEvents>
  <notProcessed switchValue="All" name="Unprocessed Category">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
  </notProcessed>
  <errors switchValue="All" name="Logging Errors">
    <listeners>
      <!--<add name="Rolling Flat File Trace &amp; Listener" />-->
    </listeners>
  </errors>
</specialSources>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions