1

ok, we are using Serilog in our web app and having it post to SEQ. (The site is a mix of classic ASP and .NET, but we only have Serilog calls in .NET)

 // create the logger
        Log.Logger = new LoggerConfiguration()
          .MinimumLevel.ControlledBy(_levelSwitch)
          .WriteTo.Seq(seqIp)
          .CreateLogger();

When I have MinimumLoggingLevel configured to be 'Information', 'Debug', or 'Verbose', every single GET or POST is being thrown into the logs, hundreds of them...

WITHOUT even calling log.Information..., log.Debug..., or log.Verbose. It just throws ever piece of info possible out to SEQ.

Here's some of the info being thrown into SEQ. It's just 'info' nothing I explicitly called to log...

Is this normal functionality?

(I have it set to Warning for now so none of this superfluous info clogs the UI)

SEQ UI

Beau D'Amore
  • 3,174
  • 5
  • 24
  • 56

3 Answers3

5

It appears you're using the Serilog.Web.Classic NuGet package. This adds an HTTP Module to your site which logs certain lifecycle events, including every request to the site, as an Information level. They have instructions on their site to change it so that those events are not logged at the Information level:

ApplicationLifecycleModule.RequestLoggingLevel = LogEventLevel.Debug;

Or if you want to disable their logging completely:

ApplicationLifecycleModule.IsEnabled = false;

Or you can remove that NuGet package from your application.

mason
  • 31,774
  • 10
  • 77
  • 121
  • from https://github.com/serilog/serilog/wiki/Configuration-Basics it would seem that it always spits out that much info at anything less than 'Warning' – Beau D'Amore Jan 09 '18 at 15:38
  • @BeauD'Amore Do you have `Serilog.Extras.Web`, which is the precursor package? Serilog itself won't log anything unless you either write code that logs to it or one of the packages you've installed is logging to it. And from the events you've shown, it looks exactly like what `Serilog.Web.Classic` logs. – mason Jan 09 '18 at 16:00
  • @BeauD'Amore Did you figure this out? Was I right? Do you have one of these two packages installed? Did you try and "clean" your project to remove any DLL's that might have been hanging around from removed packages? – mason Feb 06 '18 at 04:10
  • Hey, sorry, I don't work there anymore so I cannot verify the answer. – Beau D'Amore Feb 07 '18 at 22:35
  • This worked for me, thanks. However it is now depreciated in favor of the fluent API: `SerilogWebClassic.Configure(cfg => cfg.Disable());`. Oddly, I had installed the `SerilogWeb.Classic` package, removed it completely after deciding against using it, but still had request logging coming in that no amount of filters or overrides would prevent. Baffled, I reinstall it and included this to clean it up. – Elliot Starks Nov 14 '19 at 00:59
1

From version 4.1, this is how you change the request logging level:

SerilogWebClassic.Configure(cfg => cfg
    .LogAtLevel(LogEventLevel.Debug)
);
Christian Davén
  • 16,713
  • 12
  • 64
  • 77
0

I installed Nuget Packages, SerilogWeb.Classic and SerilogWeb.Classic.WebApi and without even using it anywhere in the code, it was set up for the project automatically. Only way to make these logs to stop coming up was to remove the packages and make sure the following three files were removed from the bin folder.

SerilogWeb.Classic.dll
SerilogWeb.Classic.WebApi.dll
SerilogWeb.Classic.xml

Once you remove that, these HTTP Get and Post calls stop coming up in the logs.

Jawad
  • 11,028
  • 3
  • 24
  • 37