Giter Club home page Giter Club logo

Comments (5)

welcome avatar welcome commented on September 24, 2024

Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better!

from nlog.

snakefoot avatar snakefoot commented on September 24, 2024

Yes that is pretty much the purpose of the different nuget-packages. NLog.Extensions.Logging + NLog.Extensions.Hosting tries to be slim wrappers that only registers NLog as logging-provider.

The LoadConfigurationFromAppSettings is included with NLog.Web.AspNetCore because it has all the dependencies included upfront for loading configuration from appsettings.json-file. Allowing it to manually load configuration before the host-builder is ready.

The LoadConfigurationFromAppSettings is best-effort and not very optimal way of loading the NLog-configuration. It just probes lots of different places for a possible NLog-configuration, which is then loaded. It kind of ressembles how NLog autoloads its Nlog.config-file.

The goal is that one just uses AddNLog or UseNLog for setting up NLog as logging-provider, and those methods will automatically load the NLog-configuration from the host-configuration (if available).

from nlog.

alexeygritsenko avatar alexeygritsenko commented on September 24, 2024

Thank you. Then could you comment on two points from the example I noted on the screenshot? Here I am trying to understand the different configuration going on in two places. Or does the configuration take place in 1 place, and then it will be used in 2? Will the way 1 place is configured affect 2 or are they unrelated?
image

from nlog.

snakefoot avatar snakefoot commented on September 24, 2024

The only reason for the premature LoadConfigurationFromAppSettings is for doing early logging (Like logger.Debug("Init main")) before Host.CreateDefaultBuilder().

But UseNLog() / AddNLog() by itself is enough for setting up NLog as Logging Provider, and perform logging using Microsoft Extension Logging ILogger-interface.

from nlog.

alexeygritsenko avatar alexeygritsenko commented on September 24, 2024

Thanks!

from nlog.

Related Issues (20)

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.