No video

Setting up Logging (w/ .NET Host, Serilog, and File Logging) - EASY WPF (.NET 5)

  Рет қаралды 14,742

SingletonSean

SingletonSean

Күн бұрын

Learn how to setup logging in a WPF application. In WPF, the best destination to write logs is to a file. However, Microsoft does not provide a mechanism to write logs to a file. That said, I also demonstrate how to leverage third-party logging providers, in this case Serilog, to write logs to a file. I go over a few useful configuration options for logging, but this tutorial focuses on setting up the logging rather than all the amazing and advanced configuration options.
TIMESTAMPS:
0:00 - Introduction
1:04 - Demo Introduction
1:48 - Microsoft.Extensions.Logging Setup
3:47 - Configuring Microsoft.Extensions.Logging
5:42 - Microsoft.Extensions.Logging w/ Host
7:15 - Issues w/ Microsoft.Extensions.Logging
8:10 - Serilog Setup
10:01 - Logging to a File w/ Serilog
12:25 - Serilog w/ Host
13:52 - Conclusion
LOGGING DOCS: docs.microsoft.com/en-us/aspn...
SOURCE CODE: github.com/SingletonSean/wpf-...
OTHER LINKS:
Donations: www.paypal.com/biz/fund?id=UB...

Пікірлер: 26
@jonnyjazzz
@jonnyjazzz 2 жыл бұрын
Great job, man. I'm old now and I hate having to figure all this crap out again with framework changes. You're clear and concise. I love it.
@SingletonSean
@SingletonSean 2 жыл бұрын
Thanks jonnyjazzz! Glad this is helpful for your learning 😁
@ZergCool
@ZergCool 3 жыл бұрын
I have leaned all of your demoes, they are very useful for me, Thank you very much. I am 67 years old, and used C# more than 10 years, but not very familiar with WPF, I think your tutorials are the best in KZbin WPF videos. I found you are updating your tutorials recently. I hope you can create a link to your playlist in every tutorial demo.
@SingletonSean
@SingletonSean 3 жыл бұрын
That's awesome to hear Cool Zerg! Never a bad time to pick up some new skills.
@vincentotieno9197
@vincentotieno9197 3 жыл бұрын
Thanks for this, SingletonSean. This is one of the more opaque areas of WPF yet it's so important.
@rmsoft
@rmsoft 9 ай бұрын
Impressive, everything but using appsettings was covered, great job.
@Tolg
@Tolg 3 жыл бұрын
One of the best explanations I've seen for setting up Serilog! THANK YOU! And I needed it for logging to a file in a console application, not WPF, but just as applicable there.
@SingletonSean
@SingletonSean 3 жыл бұрын
Great to hear Tolga! Good point, this tutorial is definitely useful for non-WPF applications.
@swapnilvmahajan
@swapnilvmahajan Жыл бұрын
Exactly what I wanted. Thanks
@markmahowald7866
@markmahowald7866 2 жыл бұрын
Thank you Sean! Every time I need to do something in WPF you were there months ago.
@SingletonSean
@SingletonSean 2 жыл бұрын
Haha, that's prefect Mark! Glad this is helpful
@ppenxhchqlz3113
@ppenxhchqlz3113 3 жыл бұрын
Great videos! Nice explanation
@joachimally1534
@joachimally1534 3 жыл бұрын
Very interesting video, Sean! :D An important aspect, especially when your application is growing.
@SingletonSean
@SingletonSean 3 жыл бұрын
I definitely agree Joachim, and thank you for the suggestion and support!
@Die_MF_Die
@Die_MF_Die 2 жыл бұрын
thank you) it helped me
@GeoffWilby
@GeoffWilby 3 жыл бұрын
Great information thank you, such an important part of any application. I would be grateful if you have any concepts for best practices for monitor these log messages within a WPF application while its operating? Keep up the great work! Thanks
@ayan-qn9or
@ayan-qn9or 2 жыл бұрын
This is really another good video, with your dependency series, I learned lot and helped me lot, your chart is also very easy to implement. I've one question here, can split the logger files for error log and log information?
@abd.alharbi
@abd.alharbi 2 жыл бұрын
Hi Sean. Thank you for this great content. Using the HostBuilder, How Do I enable the user to change the log level?
@Sygmond
@Sygmond 2 жыл бұрын
Great video. When do you dispose the logger? Can you use DI so that I don’t need to add ILogger to host for every class I want to log? Thank you!
@djelasrca8091
@djelasrca8091 3 ай бұрын
I don't know if I understand this correctly, but can you only log your own custom messages? Is there no way to log, let's say, the messages from the output console?
@MrVicho13
@MrVicho13 2 жыл бұрын
Hi, how do I setup this if my WPF application isn't using MVC model?
@leonardgberl2604
@leonardgberl2604 Жыл бұрын
Hi Sean, thanks for the tutorial. I have a question: In other tutorials, you're instantiating the commands within the ViewModels. Should I inject all the loggers for these commands into the ViewModels and then pass it to the commands, or do you prefer another solution for this case? Thanks in advance for your answer!
@SingletonSean
@SingletonSean Жыл бұрын
Hi Leonard! Great point - the view model constructor could become super big if we have to forward services, loggers, etc. to the commands we instantiate. I discuss how we can overcome this issue in the video linked below (via a "factory" function): kzbin.info/www/bejne/qmOqpGCajt9gbc0
@Tof__
@Tof__ 3 жыл бұрын
Hello there. I have simple question. Sine you are doing great WPF content, would you consider do some of ReactiveUI? Maybe even full stack like you did back a while? You cleared almost all of my MVVM questions and issues. There is no usefull ReactiveUI stack to watch, so it could be also opportunity. Thanks for reading and keep it up
@SingletonSean
@SingletonSean 3 жыл бұрын
Hey Tofik, great question! I would like to do a framework series, and ReactiveUI will definitely be my choice. It feels very intuitive, and I'm also a big proponent of Reactive Extensions. I will admit I haven't dug deep into ReactiveUI yet, but I'm excited to get into it when I get a chance! That's interesting that there's not much ReactiveUI content out there. I'd love to explore that. Unlike you suggested, I don't think I'll exactly follow in the footsteps of the full stack series. I feel like that series has gotten a bit too long, haha. Nonetheless, stay tuned for some ReactiveUI.
@Tof__
@Tof__ 3 жыл бұрын
@@SingletonSean Now I am actually excited! Way to go 👐
C# Logging with Serilog and Seq - Structured Logging Made Easy
1:07:56
Async Commands (and Async Relay Command) - EASY WPF (.NET CORE)
14:14
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 72 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 118 МЛН
Serilog 🚀 Logging in .NET 7 Made Simple & Fun
16:23
Patrick God
Рет қаралды 42 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 118 М.
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 234 М.
The Logging Everyone Should Be Using in .NET
15:34
Nick Chapsas
Рет қаралды 51 М.
Grid Shared Size Scoping/Grouping - EASY WPF (.NET 5)
4:40
SingletonSean
Рет қаралды 3,3 М.
High-performance logging in .NET, the proper way
15:56
Nick Chapsas
Рет қаралды 72 М.