Using ASP.NET Core logging

To use InvisionLog with ASP.NET Core logging you must install the following Nuget package.

Install-Package InvisionLog.AspNetCore.Logging

Minimal configuration

In your Startup class add the following code to the ConfigureServices method.

services.AddLogging(builder => builder.AddInvisionLog(opts =>
    // You must provide a StaticKey
    opts.StaticKey = "Your static key";

You can find your StaticKey in your InvisionLog Dashboard under Settings / API Keys.

Now you can inject the frameworks ILogger into Controllers and other Classes.

For example:

public class HomeController : Controller
    readonly ILogger<HomeController> _log;

    public HomeController(ILogger<HomeController> log)
        _log = log;

    public IActionResult Index()
        _log.LogInformation("Test information log!");

You're done! Logs should now appear in your InvisionLog Dashboard.


This InvisionLog package adheres to the default LogLevel settings in your appSettings.json.

A new .NET Core project comes with a Logging section in appSettings.json:

  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
  "AllowedHosts": "*"

Simply change the LogLevels that suit your needs.

Check the official Microsoft documentation about the default LogLevel settings for your project.

Alternatively you can set the minimum LogLevel from ConfigureServies in your Startup class.

services.AddLogging(builder => builder.AddInvisionLog(opts =>
    opts.StaticKey = "[Your static key]";
}).SetMinimumLevel(LogLevel.Debug)); // Set minimum LogLevel

Please note that the configuration file takes a higher priority than code. If you have configured LogLevels in your appSettings.json, then this will override your LogLevel settings from code.

Additional configuration

The AddInvisionLog method exposes a few more, optional, configration options.

Key Description
ApplicationKey This setting is optional, until you start using it!
By default InvisionLog accepts all logs from all applications that uses the StaticKey.

You can create ApplicationKeys to differentiate between applications.
Once you create an ApplicationKey then all applications must be configured with an ApplicationKey. Preferably each app should use its own key.
InvisionLogServerUrl Per default this is set to You should not change this.