Giter Club home page Giter Club logo

Comments (9)

daveleek avatar daveleek commented on July 22, 2024 1

Hey @ChristianTellefsen, @thomasheartman! that's actually a great question. I've not been directly involved with the log-implementation, but I've come across it in my source code travels.

The implementation is here:

Logger GetLogger(string name);

It's implemented as an import of LibLog source code, with what I think is reflection-based providers/adaptors for a few logging frameworks, amongst them Serilog. It appears to have a few years on it, so it could be that Serilog has evolved and left this implementation behind. I can have a look later and see if I can figure out how to set it up, and if indeed some missmatch between namespaces and expected typenames etc are the culprit.

from unleash-client-dotnet.

miltonhowe avatar miltonhowe commented on July 22, 2024 1

Well thanks to everyone for inspiring me to figure out how to do this, and I was correct in my hunch that I could configure the log level by namespace.
This is what I had to put in my NLog.Config:

<nlog>
 <rules>
    <logger name="Unleash.*" maxlevel="Info" final="true" />
    <logger name="*" minlevel="Info" writeTo="f, console" />
    <logger name="trace" minlevel="Trace" writeTo="trace" />
  </rules>
</nlog>

It was a bit tricky to figure out as I kept trying with minlevel. The trick is to use maxlevel with no writeTo - you are telling it to swallow anything up to Info level.

Hopefully I will remember this for the next time I need it! Thanks to all for responding when it turns out the solution was for me to learn how to use the tool and not in the module. Perhaps it could be added to the docs somewhere.

from unleash-client-dotnet.

thomasheartman avatar thomasheartman commented on July 22, 2024

Hey, @miltonhowe πŸ‘‹πŸΌ sorry for the slow response; this one must've slipped πŸ™‡πŸΌ

Anyway, that's a great question and you're right: I can't find anything in the docs about this either. However, checking out the samples folder, I see that the WebAppCore project contains an appsettings.json file with logger settings, for instance.

I don't know what kind of project you're using, but if I understand correctly, you might need to configure the logger for your runtime and the logger library in the SDK will just adapt to that. Does that make sense? Could you try it out? ☺️

from unleash-client-dotnet.

ChristianTellefsen avatar ChristianTellefsen commented on July 22, 2024

Hi! We're using Serilog in our Unity project, and are wondering if there is some way to make Unleash log using our Serilog loggers. The unleash logs are not visible to us since they are not using Unity's logging calls.

We couldn't find anything in the docs about this, but perhaps there is a way?

from unleash-client-dotnet.

thomasheartman avatar thomasheartman commented on July 22, 2024

Hey, @ChristianTellefsen πŸ‘‹πŸΌ I don't actually know. How do you configure logging in Unity projects?

@daveleek Do you have any input on how to configure what to log or where to log to?

from unleash-client-dotnet.

alexeyzimarev avatar alexeyzimarev commented on July 22, 2024

LibLogs connects to the currently configured logging provider like ASP.NET Core logging, Serilog, etc. It doesn't really have the logging level inside, but it passes log events to the actual logging provider.

So, to control the log level, you should configure it for your actual logging provider, and it should work.

The issue is that LibLog as a library is no longer maintained by Damian. It might eventually stop recognising specific logging providers.

from unleash-client-dotnet.

miltonhowe avatar miltonhowe commented on July 22, 2024

I don't know what kind of project you're using, but if I understand correctly, you might need to configure the logger for your runtime and the logger library in the SDK will just adapt to that. Does that make sense? Could you try it out? ☺️

Thank you for your response. My turn to apologise for the delay in responding. Now that this thread has some traction I will explain my scenario.

I have a .Net Framework 4.8 MVC 5 web app using NLog and using Unleash to read feature flags from the Gitlab repo.

The server is configured to recycle the application pools for reasons and by people over which I have effectively no control. And every time an application pool starts, thirteen lines of "Information" are logged by Unleash. This information is not meaningful to me or anyone else reading the logs so I classify it as pollution. Setting the application LogLevel higher is not a solution because I am interested in seeing the Info-level messages put out by the app, Debug even, when I am developing locally.

Fortunately the application sees a lot of use in production during work hours - the users number in the low hundreds and they are located across Canada so from workday start in Newfoundland to workday end in British Columbia the application pools tend not to go stale and get recycled. During evenings and weekends and in test environments this amounts to pages and pages of log pollution.

I am not a .Net Logger expert. it is one of those things I tend to figure out piece by piece and then forget and I think NLog is actually new to me, I think I was mostly using Serilog in the past. I might try to find a way to set the loglevel for just Unleash to show only critical whatever that level is called - I think I have done that before with another project but again I think it was probably Serilog.

Anyway that is my situation. It is not a critical issue which is why I am living with it for now but now that some people have responded on here I will probably take a minute to read all the comments and then go back and try a few ideas.

Thank you all for jumping in.

from unleash-client-dotnet.

thomasheartman avatar thomasheartman commented on July 22, 2024

Very glad to hear that you found a solution to it πŸ™ŒπŸΌ And admittedly, it's not very obvious, so good work!

Regarding the docs: Yeah, I think it'd be great to add! Would you be willing to add a section to the readme and open a PR? Feel free to add me as a reviewer and I'll have a look at it ☺️

from unleash-client-dotnet.

thomasheartman avatar thomasheartman commented on July 22, 2024

Also, because you found a solution, I'll close this thread for now.

from unleash-client-dotnet.

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.