Comments (9)
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:
unleash-client-dotnet/src/Unleash/LibLog.cs
Line 490 in 0943a2d
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.
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.
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.
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.
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.
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.
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.
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.
Also, because you found a solution, I'll close this thread for now.
from unleash-client-dotnet.
Related Issues (20)
- Have Strategies also Implement Microsoft Feature management HOT 2
- Does the Context Need to be Cloned? HOT 4
- Reducation in target frameworks HOT 1
- Replacement of LibLog with Microsoft.Extensions.Logging.Abstractions HOT 1
- Record metrics using System.Diagnostics.Metrics HOT 2
- Split of nuget package HOT 2
- Negate operator not work in dot net sdk HOT 3
- api/client/metrics return 400 when using System.Text.Json for seriaization. HOT 5
- Feature toggles are fetched in a chron manner instead of when a feature flag is actually needed HOT 9
- Removal of Microsoft.CSharp package dependency HOT 4
- Update licence inclusion in Nuget HOT 2
- Platform specific test suite for .NET Framework to run in CI HOT 2
- Receiving Json Parsing error when receiving 304 status when ETag in response header is null. HOT 1
- We see a lot "The `appName` property is required. It was not present on the data you sent." HOT 2
- Unhandled exceptions in Unleash's background process HOT 2
- synchronousInitialization: true should throw exception if exception happens in the init flow (network, authorization, etc) HOT 3
- InvalidOperationException being thrown from Unleash.Scheduling.SystemTimerScheduledTaskManager.ConfigureTask HOT 2
- Empty userId breaks gradual rollout 100% expected behavior. HOT 3
- Built-in JSON serialization without reflection HOT 3
- Avoid subtle errors and improve DX when setting a custom serializer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unleash-client-dotnet.