Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Create always new empty file ontop #48

Open
RoCore opened this issue Jan 25, 2018 · 1 comment
Open

Create always new empty file ontop #48

RoCore opened this issue Jan 25, 2018 · 1 comment

Comments

@RoCore
Copy link

RoCore commented Jan 25, 2018

Hi,

I do have two serilog sinks. mssql and rollingfile. Somehow there is a strange behavior. If the application starts, the rollingfile create always an empty log file (see the pic below). Do I have some misconfigs?

image

"Serilog": {
    "MinimumLevel": "Warning",
    "WriteTo": [
      {
        "Name": "MSSqlServer",
        "Args": {
          "connectionString": "",
          "tableName": "SeriLogs"
        }
      },
      {
        "Name": "RollingFileAlternate",
        "Args": {
          "logDirectory": ".\\logs",
          "fileSizeLimitBytes": 1048576
        }
      }
    ]
  }

nugets

    <PackageReference Include="FluentValidation" Version="7.3.4" />
    <PackageReference Include="FluentValidation.AspNetCore" Version="7.3.4" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.1" />
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="2.1.0" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="2.4.0" />
    <PackageReference Include="Serilog.Sinks.MSSqlServerCore" Version="1.1.0" />
    <PackageReference Include="Serilog.Sinks.RollingFileAlternate" Version="2.0.9" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="1.1.0" />
@se7vanj
Copy link

se7vanj commented Jan 31, 2019

I am also facing the same issue empty 0KB files created.

File size limit set to 4MB per file, the content actually goes to the sink (RollingFileAlternate) and it rolls the files but does not really writes the contents? it was lost. As we see more files with numbers.

It did work for 2 days after that it stopped working even after restarting AppPool & Machine.

Initially I doubted it is something to do with calling CloseAndFlush (which I am calling during OnExit/OnError events), but it doesn't look like the problem!

image

Below are the packages that I use:

<package id="EntityFramework" version="6.1.1" targetFramework="net47" /> <package id="Microsoft.AspNet.WebApi" version="5.2.2" targetFramework="net47" /> <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net47" /> <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net47" /> <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.2" targetFramework="net47" /> <package id="Microsoft.Owin" version="4.0.0" targetFramework="net46" /> <package id="Microsoft.Owin.Host.SystemWeb" version="4.0.0" targetFramework="net46" /> <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net46" /> <package id="OctoPack" version="3.0.46" targetFramework="net47" developmentDependency="true" /> <package id="Owin" version="1.0" targetFramework="net46" /> <package id="PostSharp" version="6.1.8-preview" targetFramework="net46" /> <package id="PostSharp.Patterns.Common" version="6.1.8-preview" targetFramework="net46" /> <package id="PostSharp.Patterns.Common.Redist" version="6.1.8-preview" targetFramework="net46" /> <package id="PostSharp.Patterns.Diagnostics" version="6.1.8-preview" targetFramework="net46" /> <package id="PostSharp.Patterns.Diagnostics.Redist" version="6.1.8-preview" targetFramework="net46" /> <package id="PostSharp.Patterns.Diagnostics.Serilog" version="6.1.8-preview" targetFramework="net46" /> <package id="PostSharp.Redist" version="6.1.8-preview" targetFramework="net46" /> <package id="Serilog" version="2.7.1" targetFramework="net46" /> <package id="Serilog.Enrichers.CorrelationId" version="1.0.1" targetFramework="net46" /> <package id="Serilog.Formatting.Compact" version="1.0.0" targetFramework="net46" /> <package id="Serilog.Settings.AppSettings" version="2.2.2" targetFramework="net46" /> <package id="Serilog.Sinks.Async" version="1.3.0" targetFramework="net46" /> <package id="Serilog.Sinks.File" version="4.0.1-dev-00801" targetFramework="net46" /> <package id="Serilog.Sinks.PeriodicBatching" version="2.1.1" targetFramework="net46" /> <package id="Serilog.Sinks.RollingFileAlternate" version="2.0.9" targetFramework="net46" /> <package id="Serilog.Sinks.Seq" version="4.0.0-dev-00148" targetFramework="net46" /> <package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net46" /> <package id="System.ValueTuple" version="4.3.0" targetFramework="net46" /> <package id="TMNAS.Enterprise.Logger" version="1.0.0.6" targetFramework="net46" />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants