The Logging Everyone Should Be Using in .NET

  Рет қаралды 83,766

Nick Chapsas

Nick Chapsas

Күн бұрын

Пікірлер: 146
@xmesaj2
@xmesaj2 3 ай бұрын
Lidl swag makes you a better developer
@GuilhermeFlores
@GuilhermeFlores 3 ай бұрын
I have the lidl shorts hahaha
@goldmund67
@goldmund67 3 ай бұрын
OTEL and/or Log Shipping can be overwhelming when you have used only traditional console loggers for many years, not to mention they all want you to ship to cloud. This is the simplest and clearest 'get started' walkthrough I've seen to date.VERY appreciated.
@PedroPabloCalvoMorcillo
@PedroPabloCalvoMorcillo 3 ай бұрын
This video is invaluable for my team and myself and arrives with perfect timing for our necessities. Thank you, thank you, thank you.
@nickharmer6096
@nickharmer6096 3 ай бұрын
First time I’ve ever been able to watch one of Nick’s videos and think ‘we already do that!’ Result!
@jackkendall6420
@jackkendall6420 3 ай бұрын
Nick's drip goes so hard
@sb_dunk
@sb_dunk 3 ай бұрын
Just a lidl drip
@TGeorgie
@TGeorgie 3 ай бұрын
Seq is not free, you need to pay for a license to deploy to a server. Serilog (Loki Sink) + Loki + Grafana is the easiest and fastest way to get a free, simple, queryable, structured logging solution up and running. No magic instrumentation, no security headaches with certificates (like with ELK, just let the reverse proxy handle it), no pantheon of collectors and exporters and services. It doesn't have metrics and tracing (though they can be added) but sometimes you just want something simple to start off with and logging is the most crucial of the 3 observability components when starting out.
@g3ff01
@g3ff01 3 ай бұрын
Do these anything to do with OpenTelemetry, or is this a completely separate stack?
@felixelbjunge8416
@felixelbjunge8416 2 ай бұрын
@@g3ff01 They do work with OTel. Loki can infact also ingest OTel logs, but also has its own sink for Serilog using its own API. Grafana is what is used to build the Dashboards and bring it all together. They also have services to ingest other data like traces into Tempo, or metrics into Prometheus. Seq is more or less and all-in-one solution and I like it for lokal testing on my machine because its smaller. Grafana + Loki + Tempo etc. is a stack of multiple services that you can piece together as you need them. Thats what we run in Prod.
@nathounathou
@nathounathou Күн бұрын
@@g3ff01 TGeorgie describes a indeed completely different stack, althought Loki Grafana support otlp using the otlphttp exporter
@andriiyustyk9378
@andriiyustyk9378 3 ай бұрын
It's a very interesting topic. I think it would be very useful to a video about how to integrate like open telemetry + some scoped logging context/metadata (e.g. if we need to log a tenant ID in a multi-tenant app) + for example, Azure app insights as a logging storage, but in a case of using ILogger from DI. I don't think that in a real-world app, devs will create a new logger manually each time.
@hck1bloodday
@hck1bloodday Ай бұрын
serilog implements the ILogger, and you can use the serilog sink package
@nalux
@nalux 3 ай бұрын
Great video. Howerver, albeit not the scope of this video. When configuring the endpoints for OTEL. How should we go about doing that in production? I mean, there is an API key, that we want to keep secret, so perhaps fetching that from i.e HCP vault. Then I suppose we can use an environment.variable for the endpoint URI.
@John.Oliver
@John.Oliver 3 ай бұрын
Been using SEQ with Serilog for years but this highlighted how easy it is to include open telemetry. Thanks Big Fella. Another great video.
@thehuggz-i9k
@thehuggz-i9k 3 ай бұрын
Thank you so much for this. I've been investigating integrating OTLP into some new development currently on my plate and this answers a LOT of the questions that I had been having. Appreciate all you do!
@BernhardMillauer
@BernhardMillauer 3 ай бұрын
nice, serilog and seq are the best combination we're using since years!
@KaineVarley
@KaineVarley 3 ай бұрын
Hey Nick thx for a great video. How do you feel about Application Insights and Log Analytics?
@atziazas
@atziazas 3 ай бұрын
Had the same question
@Punkologist
@Punkologist Ай бұрын
@@atziazas me too. We pretty much use ILogger to app insights and all our stuff is running in apps service is Azure. and I'm wondering now if we should be changing that?
@vmachacek
@vmachacek 3 ай бұрын
the sweater looks total dripp
@gui.ferreira
@gui.ferreira 3 ай бұрын
LIDL 💛💙
@theREALkorvanica
@theREALkorvanica 3 ай бұрын
Will Dometrain courses be available from the Lidl middle aisle any time soon Nick ?
@nickchapsas
@nickchapsas 3 ай бұрын
I'm trying to get them to sponsor but they just want me to advertise their "Greek Week" instead
@CRBarchager
@CRBarchager 3 ай бұрын
3:10 Do you have a video about the structered Logging Naming Convention for attributes? - This is a new "problem" when doing the structured logging as the name you provide in the template will be name in the logging provider like ElasticSearch. So lets say you were to log the execption ex and you write the structered log like ("There was an error handling the request. The error was {Ex}", ex.Message); - The naming in template could easily be {Exception} or {ExceptionMessage} or just {Message}. If you're the only developer on a project that's not a problem but if you're a team you need to have a standard for this attributes but I haven't found a "standard" for this and might have missed if you're ever mentioned this in any of your videos or talks.
@TehGM
@TehGM 3 ай бұрын
I'd like to have some tips re that too. Even in my own project, I find myself I am not consistent enough - because I don't know what's good and simple vs too short vs too bloated. I catch myself on that often.
@Wfmike
@Wfmike 3 ай бұрын
If you use mediatr then you can catch exceptions or log the request in one place and define your template there. Alternatively if you use source generated high performance logging you can define templates in a resource file for example
@TehGM
@TehGM 3 ай бұрын
@@Wfmike I don't think that's the concern. We know that. The concern is good old variable naming, but with logging in mind in this case.
@Wfmike
@Wfmike 3 ай бұрын
@@TehGM I'm not sure if you are going to find a specific naming convention for that. Every team needs to agree to a format that suits them.(And build guard rails to adhere to the convention)
@josefromspace
@josefromspace 3 ай бұрын
Just post it on whatever chat app your team uses and have your team vote for options. There’s not always going to be a convention for everything.
@petrowi
@petrowi 3 ай бұрын
I am in "big tech" company, OTel is still struggling internally. There are as many ways to emit telemetry as there are organizations in my company. Some services emit almost fully denormalized data - one table with something like 500 columns. My point is - don't do what big tech does, instead do what a very serious tech startup would do
@radutomy
@radutomy 3 ай бұрын
So what does a very serious startup do?
@AKA-077
@AKA-077 3 ай бұрын
.
@viniciusvbf22
@viniciusvbf22 3 ай бұрын
Serious startups spend millions of investor dollars buying storage to store 10GB of log per hour in the cloud provider 😅
@Bennevisie
@Bennevisie 2 ай бұрын
Amen.. I've seen some "Big Tech" companies that don't have any structured logging in place. Customer queries have to be resolved by engineers remoting into various servers and inspecting local log files. I 💩you not.
@jackkendall6420
@jackkendall6420 3 ай бұрын
Great vid btw. This is what I wish I had a year ago when I first decided to look into OTEL lol.
@hafizabdullah7488
@hafizabdullah7488 3 ай бұрын
Which is better? - use serilog sink to push logs - use fluentbit to collect logs from the app
@nikolayrogchev9628
@nikolayrogchev9628 3 ай бұрын
Great video, I was not aware of otlp
@Ahmed-ui5wn
@Ahmed-ui5wn 3 ай бұрын
Great content as usual. One question: how can we use open telemetry in production, where could the logs be exported to. Any ideas or suggestions. Thanks
@nickchapsas
@nickchapsas 3 ай бұрын
You can use the ELK stack or even Seq itself since it is OSS, as well as any other paid offering. I’ve used DataDog in the past
@MelGrubb
@MelGrubb 3 ай бұрын
I've always assumed it was pronounced "seek" as in "sequence".
@nickchapsas
@nickchapsas 3 ай бұрын
Ah that's smart actually
@DoorThief
@DoorThief 3 ай бұрын
Same here
@cs62594
@cs62594 3 ай бұрын
You are correct, I spoke to Nicholas Blumhardt (the guy behind Seq) at NDC Oslo and he did pronounce it "seek" :)
@krss6256
@krss6256 3 ай бұрын
I've been pronouncing it like Nick for many years already. But 'seek' makes so much sense...
@alwaseem5309
@alwaseem5309 3 ай бұрын
Is there any video on how to build a custom solution to send and view those logs?
@oleggolovkov957
@oleggolovkov957 3 ай бұрын
Of course I know seqs, I do the seqs every day
@RusslanK
@RusslanK 3 ай бұрын
It feels like you are about starting new trend for .NET developers clothes... with your nice Lidl shirt 😀
@catfishfortesque-smythe437
@catfishfortesque-smythe437 3 ай бұрын
Id already added Open Telemetry but it can get complicated when configuring a boot logger, Serilog, Open Telemetry, and Application insights (or Grafana etc) - then configuring Tracing and Metrics, adding custom Meters. I managed it but I'm not convinced it's all correct. Maybe a new course idea for Dometrain on Observality...? With Serilog having so many different ways to do the same thing, it's becoming confusing...
@LucasOliveira-sn8ls
@LucasOliveira-sn8ls 3 ай бұрын
AWESOME!!!!! Thanks for sharing!
@akshsuri4321
@akshsuri4321 3 ай бұрын
Hi Nick, Thanks for this amazing and knowledgeable video. I have a question though. Let’s say I want to log to a file or maybe create my own log viewer within the application which I can host with the application and push my logs there using open telemetry. Is that doable?
@flybyw
@flybyw 3 ай бұрын
I wonder if the exporter runs asynchronously as a background service at the lowest priority, unless a critical exception must not be lost and should be logged immediately before the app crashes.
@ecblanco
@ecblanco 3 ай бұрын
Nice PJs Nick! :D
@pilotboba
@pilotboba 3 ай бұрын
I always assumed it was pronounced SEEK (as is seek and you shall find). :)
@RubenALopes
@RubenALopes 3 ай бұрын
Lidl is the new Gucci 💖
@byrondelgado8165
@byrondelgado8165 3 ай бұрын
Nick do you have an example with Azure App Insights?
@erkinkurt6799
@erkinkurt6799 3 ай бұрын
What if the external logger service goes down? Is there a possibility to also save the logs to the file in a host or something? In case of an event where the logger service is down and we need to investigate something how can we achieve that?
@Forenaits
@Forenaits 2 ай бұрын
You can log to a file and have an agent that reads that file and sends the content to your log server in otel format, for example. Or you write your logs to different sources (otel cloud, file,…) at the same time.
@artipichersky9132
@artipichersky9132 3 ай бұрын
Hey nick - I was wandering, as a Unity developer, a former validation developer at intel, what courses whould i take to make my c# knowledge better? i mean, i do have 3 years of experience in a varaity of c# useages (not .Net in particular), and i am a computer science major, so taking the "SOLID" course or those kind seem obsolete.
@DanieDuPreez
@DanieDuPreez 3 ай бұрын
Hey Nick, thank you for this great video. Do you perhaps know of a way how OpenTelemetry can log to files? (This is a requirement from our client we do work for)
@woocaschnowak
@woocaschnowak 3 ай бұрын
Great video. One question though. What is the benefit of adding Serilog to the picture? Never used it, so maybe that's a dumb question with obvious answer ;-)
@josefromspace
@josefromspace 3 ай бұрын
Serilog, in general, brings many benefits, but in this specific context you can get a more useful formatting as well as the ability to serialize objects as part of the structured logged message. Please, keep in mind this is a very superficial answer. Serilog’s true benefits become more evident as more intricate scenarios come into play.
@woocaschnowak
@woocaschnowak 3 ай бұрын
@@josefromspace ah. Thanks. Just always assumed that Serilog is basically predecessor of Microsoft.Extensions.Abstraction.Logging with (mostly) similar functionalities and just small deviations in interfaces or some obscure functionality. Will take a closer look than.
@josefromspace
@josefromspace 3 ай бұрын
@@woocaschnowakabsolutely, Serilog’s claim of fame was that by using structured logging, it allocated less memory on the heap than .Net’s counterpart at the moment. As time passed both have grown in functionality, definitely worth looking into it.
@seehay8498
@seehay8498 3 ай бұрын
I just install the Seq sink. I've also coded a nuget package that enhances the log properties with the user information, payloads, etc.
@ChristopherBriddock
@ChristopherBriddock 3 ай бұрын
Can I get a link?
@MrNinierdelavega
@MrNinierdelavega 3 ай бұрын
Apologies, if it has been asked before, what font are you using in your video?
@shahrukhkhan3967
@shahrukhkhan3967 3 ай бұрын
Nice shirt ❣
@honlee5705
@honlee5705 Ай бұрын
Hi there, how would you be able to NUnit Test specfically NSubstitute to test OpenTelemetry logging, thanks
@FalcoPunch182
@FalcoPunch182 3 ай бұрын
How would I log transactions or "sagas" from multiple services, that might collaborate to fulfill a task. So that I have logs for all steps and can combine logs from multiple services for exactly one business process?
@luisbernalcespedes
@luisbernalcespedes 3 ай бұрын
Do you know if the .NET built-in logging provider can deconstruct the objects and log its composing properties using the OpenTelemetry exporter?
@liammclennan
@liammclennan 3 ай бұрын
Yes it can
@paulreicherdt4604
@paulreicherdt4604 3 ай бұрын
I'm not quite sure - how is it different to Application Insights?
@heshamabdo6024
@heshamabdo6024 3 ай бұрын
Question: what is the name of the app you use to test the API ?
@HydroMoonLights
@HydroMoonLights 3 ай бұрын
It is called Kong Insomnia.
@thefattysplace
@thefattysplace Ай бұрын
I'm adding logging into a bunch of apps at the moment, and to be honest this level of logging just isn't needed. Normal structured logging is enough for a lot of smaller applications. It comes down to only logging what you actually need and will look at, all the rest is useless fluff.
@m-ai-tube
@m-ai-tube 3 ай бұрын
if the default logger gets the job done, i don't see value of using the additional package , serilog in this case.
@antonmartyniuk
@antonmartyniuk 3 ай бұрын
The beaty of using Seq is you can also visualise in it your OTEL traces and spans. Without having to use a seperate software, like Jaeger
@Juggernaut518
@Juggernaut518 3 ай бұрын
That was exactly the thing I expected to see in the video, but didn't see. Thanks for confirming Seq can do that!
@JeremyHolovacs
@JeremyHolovacs 3 ай бұрын
... ok but how to add OTEL traceability for microservices subscribed to a service bus?
@ThanosPapathanasiou
@ThanosPapathanasiou 3 ай бұрын
Logging από τα LIDL? :D
@arvind.b
@arvind.b 3 ай бұрын
why string interpolation in logs not accepted as standard?
@liammclennan
@liammclennan 3 ай бұрын
Structured logging makes it easier to analyze logs. For example, if you wanted to see the 95th percentile response time grouped by day.
@M0J0-RL236
@M0J0-RL236 3 ай бұрын
"Getting weather for {CityName}" is the same string every time, so you can easily search for this in your logs and go from there. If you used string interpolation, you'd have to search for the common substring which would be "Getting weather for " and that's a bit weird
@cloudd901
@cloudd901 2 ай бұрын
So you're saying that I shouldn't be logging the console to text files and pushing them to a database. 😅
@Sergio_Loureiro
@Sergio_Loureiro 3 ай бұрын
Is it only me who whenever hears the "Telemetry" word thinks *VERY INTRUDING PRIVACY INVASION* ?
@nepalxplorer
@nepalxplorer 3 ай бұрын
Nick looking different, cool!
@TheCodeCreator
@TheCodeCreator 2 ай бұрын
Is that a Lidl tshirt? What the heck?
@ibrahimhussain3248
@ibrahimhussain3248 3 ай бұрын
I hate that you cannot export Request collections in insomnia
@hei4227
@hei4227 3 ай бұрын
Hello guys how can i have access to Nick's discord server? (I have the 5 dollar subscription)
@nickchapsas
@nickchapsas 3 ай бұрын
Have you linked your KZbin channel to Discord?
@hei4227
@hei4227 3 ай бұрын
@@nickchapsas yes nick, still dont have access! (update: i subscribed to patreon and got access)
@petropzqi
@petropzqi 3 ай бұрын
Can we use the log instead of events? Can I subscribe on the log and then act on them. For let's say save data persistent?
@BlTemplar
@BlTemplar 3 ай бұрын
You shouldn't use logs for anything they are not meant for.
@josefromspace
@josefromspace 3 ай бұрын
No.
@LilPozzer
@LilPozzer 3 ай бұрын
a friend of mine has a full swaggy lidl outfit guys!!
@ablues15
@ablues15 Ай бұрын
SEQ is pronounced SEEK.
@hellowill
@hellowill 2 ай бұрын
Big tech uses Java 🤔
@LilPozzer
@LilPozzer 3 ай бұрын
god damn lidl !
@SuperJB1981
@SuperJB1981 3 ай бұрын
Is that a LIDL tshirt? 😅🤣😂
@troncek
@troncek 3 ай бұрын
Why not string interpolated logging?
@DoorThief
@DoorThief 3 ай бұрын
there's a few reasons, but structured logging allows you to preserve the parameters in such a way that you could query them later like he's doing in the video. Otherwise, you'd have to use complicated patterns (regex) to extract those parameters again after being joined into one string. Also, each unique log line would allocate a new string further increase in garbage collection pressure and slowing down the app.
@legittrololo2163
@legittrololo2163 3 ай бұрын
Why English thow?
@i.t.9015
@i.t.9015 3 ай бұрын
After watching this video I feel shame because of logging we are doing in our company. 😢
@MatinDevs
@MatinDevs 3 ай бұрын
First comment
@JackBauerDev
@JackBauerDev 3 ай бұрын
Long winded
@NotACat20
@NotACat20 3 ай бұрын
Congrats, now every log entry filled with tons of useless bullshit.
@nickchapsas
@nickchapsas 3 ай бұрын
It's only useless until you need it. Then you'll wish you had it
@NotACat20
@NotACat20 3 ай бұрын
You never will need this default *additional* fields, like corellation id / other stuff, unless you really have linked services with such tracing. But you example free from this. It never useful in given example. This did not meant what them useless, but by default they have little no sense, but you pay for this. I know enough about tracing and how get 4gib trace log in few seconds, so, no, this is reverse of what software should do by default.
@NotACat20
@NotACat20 3 ай бұрын
Also logs is not tracing - is even splitted in open telemetry, but they mix all things down poorly. Really poorly. Unfortunately .net have no better alternatve.
@BlTemplar
@BlTemplar 3 ай бұрын
​@@NotACat20 Why do you mean they mix them poorly? There's logging, tracing and metrics. They are all separate things. You can use OpenTelemetry for everything or you can use it for something specific like Nick did in this video.
@BlTemplar
@BlTemplar 3 ай бұрын
There's also an alternative approach: just write logs to console output and capture it with something like Filebeat and send them to Elasticsearch. Elasticsearch is also more widely used than Seq.
What's New in .NET 9 with Examples
25:02
Nick Chapsas
Рет қаралды 40 М.
Testing in .NET is About to Change
12:54
Nick Chapsas
Рет қаралды 82 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 85 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 5 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 88 МЛН
Why I'm Worried About Blazor and its Future
19:31
Nick Chapsas
Рет қаралды 33 М.
What is OpenTelemetry?
12:55
Highlight
Рет қаралды 12 М.
Using EF Core’s Coolest Feature to Audit in .NET
26:06
Nick Chapsas
Рет қаралды 38 М.
Coding Is Changing...How to GET AHEAD in 2025 (must-know)
10:28
Internet Made Coder
Рет қаралды 26 М.
.NET and C# are in trouble. Here is what I'd do.
10:57
Ed Andersen
Рет қаралды 101 М.
The Right Way To Return API Errors in .NET
10:40
Nick Chapsas
Рет қаралды 56 М.
The Pattern You MUST Learn in .NET
20:48
Nick Chapsas
Рет қаралды 92 М.
Getting Started with Event Sourcing in .NET
37:07
Nick Chapsas
Рет қаралды 60 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 85 МЛН