GithubHelp home page GithubHelp logo

serilog.sinks.stackify's People

Contributors

jpknoll avatar sporty81 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

serilog.sinks.stackify's Issues

Possible memory leak in sink?

Your excellent component is used in our project within ASP.NET Core 1.1 application serving mostly JSON as REST API. Serilog+Stackify is used in Development environment together with two other sinks - EventLog and Trace. Configured through appconfig.json.
When we ran load tests to check on authentication logic performance, we noticed memory size creep. In memory profiler it shows StackifyLib.Models eating up space:
stackify_memory_1
When we remove Stackify Sink from configuration - problem with memory disappears.
We did not yet dig though it extensively as it is used only on developer machine configurations and not in production.
Maybe you have any insights what may cause this problem? Can we provide any other information for investigations?

Here is more information for starters:
ASP.NET Core 1.1.2 (+ AspNetCore.Mvc v1.1.3)
Full .Net Framework 4.6.2
Visual Studio 2017
Serilog 2.5.0-dev-00817
Serilog.Sinks.Stackify v3.0.37-dev-00043
Serilog.Extensions.Logging v1.4.1-dev-10155
Serilog.Settings.Configuration v2.4.0
Serilog.Sinks.Trace v2.1.0
Serilog.Sinks.EventLog v3.0.37-dev-00043

Configuration:

{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Warning",
      "Microsoft": "Warning"
    }
  },
  "Serilog": {
    "MinimumLevel": {
      "Default": "Debug",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "Enrich": [ "FromLogContext" ],
    "Properties": {
      "Application": "ApplicationName"
    },
    "Using": [ "Serilog.Sinks.Trace", "Serilog.Sinks.EventLog", "Serilog.Sinks.Stackify" ],
    "WriteTo": [
      {
        "Name": "Stackify",
        "Args": {
          "restrictedToMinimumLevel": "Debug"
        }
      },
      {
        "Name": "Trace",
        "Args": {
          "restrictedToMinimumLevel": "Debug",
          "outputTemplate": "{Timestamp:d.MMM HH:mm:ss.fff} (ReqId:{RequestId}) {Message}{NewLine}{Exception}"
        }
      },
      {
        "Name": "EventLog",
        "Args": {
          "source": "ApplicationName",
          "restrictedToMinimumLevel": "Warning",
          "manageEventSource": true
        }
      }
    ]
  }
}

Setup in Startup.cs code:
In Startup() method

// ... after config reading/loading
Serilog.Debugging.SelfLog.Enable(msg => System.Diagnostics.Trace.Write(msg));
Log.Logger = new LoggerConfiguration()
    .ReadFrom.Configuration(this.Configuration)
    .CreateLogger();

In Configure() method

// ..some code before
loggerFactory.AddSerilog(dispose: true);
if (_hostingEnvironment.IsDevelopment())
{
    app.UseMiddleware<StackifyMiddleware.RequestTracerMiddleware>();
}
// ... some more setup code

// Last line in method - Ensure any buffered log events are sent at shutdown
appLifetime.ApplicationStopped.Register(Log.CloseAndFlush);

And another picture from profiler:
stackify_memory_2

Cannot log to Stackify Prefix

I've tried various config changes but my logs are not being captured or output in Stackify Prefix. Logging to text/JSON works just fine.

I'm using Serilog 2.4.0, Serilog.Sinks.Stackify 1.25.4, and StackifyLib 1.25.4 (all latest version from NuGet)

Here's my config:

  <appSettings>
    <add key="Stackify.AppName" value="AutoWaifu" />
    <add key="Stackify.Environment" value="DEV" />
  </appSettings>
            Serilog.Debugging.SelfLog.Enable((msg) =>
            {
                Debug.WriteLine("Serilog: " + msg);
            });

            StackifyLib.Logger.ApiKey = null;
            StackifyLib.Utils.StackifyAPILogger.LogEnabled = true;
            StackifyLib.Utils.StackifyAPILogger.OnLogMessage += (string data) =>
            {
                Debug.WriteLine(data);
            };

             Log.Logger = new LoggerConfiguration()
                            .MinimumLevel.Verbose()
                            .WriteTo.File("log.txt")
                            .WriteTo.File(new JsonFormatter(null, true), "log.json")
                            .WriteTo.Stackify()
                            .CreateLogger();

I'm running Prefix on port 2012 (the default) if that helps at all. Here's my Output log after running my program:


StackifyLib: Creating new LogClient StackifyLib.net-serilog
StackifyLib: Creating new LogQueue
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 1.25 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 1.56 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 1.95 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 2.44 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 3.05 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 3.82 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 4.77 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Adjust log flush interval up to 5.00 seconds
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured.
StackifyLib: Skipping IdentifyApp(). No APIKey configured

Thank you!

Cannot get Serilog logs into Prefix in ASP.NET Core 1 web application

ASP.NET Core Web (MVC) application. Stackify Prefix is installed.
Added NuGet packages for Serilog, Serilog.Sinks.Stackify and StackifyLib.

I can see events of MVC actions invoked normally in Prefix, even SQL Selects, but not logging statements from Serilog.
I can see those events in EventLog (another Sink) or in Trace (Serilog.Sinks.Trace), but still not in Prefix.

Here is appsettings.json which sets up Serilog and its sinks:

"Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Warning",
      "Microsoft": "Warning"
    }
  },
  "Serilog": {
    "Using": [ "Serilog.Sinks.Trace", "Serilog.Sinks.EventLog", "Serilog.Sinks.Stackify" ],
    "MinimumLevel": {
      "Default": "Debug",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "Stackify",
        "Args": {
          "restrictedToMinimumLevel": "Debug"
        }
      },
      {
        "Name": "Trace",
        "Args": {
          "restrictedToMinimumLevel": "Debug"
        }
      },
      {
        "Name": "EventLog",
        "Args": {
          "source": "MyApp",
          "restrictedToMinimumLevel": "Warning",
          "manageEventSource": true
        }
      }
    ],
    "Enrich": [ "FromLogContext" ],
    "Properties": {
      "Application": "MyApp"
    }
  }

What am I doing wrong?
Should I somehow try to add those app keys (using only Prefix)

<add key="Stackify.AppName" value="My App Name" />
<add key="Stackify.Environment" value="" />
<add key="Stackify.ApiKey" value="" />

but how I can add them using appsettings.json?

Configuring sink using JSON

Hi!

There is a proposal over at Serilog.Settings.Configuration where sink developers would be able to specify an extension point specially designed to support JSON configuration. If this is something you would find beneficial for your sink, please give a thumbs up or something. If not, have a nice day and continue being awesome!

can't install package

Attempting to gather dependency information for package 'Serilog.Sinks.Stackify.1.23.3' with respect to project '', targeting '.NETFramework,Version=v4.6.2'
Gathering dependency information took 14,79 sec
Attempting to resolve dependencies for package 'Serilog.Sinks.Stackify.1.23.3' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Serilog.Sinks.Stackify.1.23.3'
Resolved actions to install package 'Serilog.Sinks.Stackify.1.23.3'
Retrieving package 'Serilog.Sinks.Stackify 1.23.3' from 'nuget.org'.
Adding package 'Serilog.Sinks.Stackify.1.23.3' to folder ''
Added package 'Serilog.Sinks.Stackify.1.23.3' to folder ''
Install failed. Rolling back...
Package 'Serilog.Sinks.Stackify.1.23.3 : Serilog [1.5.14, ), StackifyLib [1.23.3, )' does not exist in project ''
Removing package 'Serilog.Sinks.Stackify.1.23.3 : Serilog [1.5.14, ), StackifyLib [1.23.3, )' from folder ''
Removed package 'Serilog.Sinks.Stackify.1.23.3 : Serilog [1.5.14, ), StackifyLib [1.23.3, )' from folder ''
Executing nuget actions took 2,84 sec
Failed to add reference. The package 'Serilog.Sinks.Stackify' tried to add a framework reference to 'System.IO' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.

no 4.6.x support?

Can't install

Severity Code Description Project File Line Suppression State
Error Failed to add reference. The package 'Serilog.Sinks.Stackify' tried to add a framework reference to 'System.Runtime' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance. 0

Used an older version (1.0.12) and it was fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.