Steeltoe Documentation
  • Why Steeltoe
    Overview Microservices Cloud Web Applications Event Driven
  • Get Started
    Steeltoe Initializr Guides Documentation API Browser Blog
  • Projects
    Steeltoe Application Configuration Steeltoe Circuit Breakers Steeltoe Dynamic Logging Steeltoe Management Steeltoe Messaging Steeltoe Network File Shares Steeltoe Security Steeltoe Service Connectors Steeltoe Service Discovery Steeltoe Stream
  • Support
  • Community
Search Results for

    Table of Contents
    . . .
    X

    Dynamic Logging Provider

    This logging provider is a wrapper around the Microsoft Console Logging provider. This wrapper allows for querying the currently defined loggers and their levels as well as then modifying the levels dynamically at runtime.

    CAUTION: External tool integration involves sending the fully-qualified logger name over HTTP. Avoid using colons in the name of a logger to prevent invalid HTTP Requests.

    Usage

    Before starting to use Steeltoe provider, you should know how the .NET logging service works, as it is nothing more than a wrapper around the existing Microsoft console logger.

    To use the Steeltoe logging provider, you need to:

    1. Add the logging NuGet package references to your project.
    2. Configure Logging settings.
    3. Add the dynamic logging provider to the logging builder.

    Add NuGet References

    To use the logging provider, you need to add a reference to the Steeltoe Dynamic Logging NuGet.

    The provider is found in the Steeltoe.Extensions.Logging.DynamicLogger package.

    You can add the provider to your project by using the following PackageReference:

    <ItemGroup>
    ...
        <PackageReference Include="Steeltoe.Extensions.Logging.DynamicLogger" Version="3.1.0"/>
    ...
    </ItemGroup>
    

    Configure Settings

    As mentioned earlier, the Steeltoe Logging provider is a wrapper around the Microsoft Console logging provider. Consequently, you can configure it the same way you would the Microsoft provider. For more details on how this is done, see the section on Log Filtering.

    Add the Logging Provider

    To use the provider, you need to add it to the logging builder by using the AddDynamicConsole() extension method:

    using Steeltoe.Extensions.Logging;
    public class Program
    {
        public static void Main(string[] args)
        {
            var host = WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .ConfigureLogging((builderContext, loggingBuilder) =>
                {
                    // Add Steeltoe Dynamic Logging provider
                    loggingBuilder.AddDynamicConsole();
                })
                .Build();
    
            host.Run();
        }
    }
    
    X
    • Edit this page
    Back to top
    © 2017-2021 VMware, Inc. All Rights Reserved. • Privacy Policy • Your California Privacy Rights • Terms of Use • Trademark Guidelines