Blazor WebAssembly : Logging to Database using Custom Logger Provider - EP27

preview_player
Показать описание
Hey Coders,
In this tutorial, I am showing how you can log exceptions from client & server project for Blazor WebAssembly project. First I am going through the demo app and showing where I am intentionally throwing errors. Then I am logging errors on the server side by creating a Logger Provider and then I am doing the same thing on the client but using HttpClient for logging errors.

0:00 - Explaining the demo app
4:53 - Logging Server Errors
20:28 - Logging Client Errors
29:30 - Setting up Log Levels

#Blazor #Logging #Database

#CuriousDrive #WeLoveCoding
Рекомендации по теме
Комментарии
Автор

Excellent as usual.
Thank you very much Fahad.

talkathiriify
Автор

This worked great in the end! Thanks alot!

wassollderscheiss
Автор

I tried following your example - but at the same time adopt it into our usecase. Now as most examples I found, your chat is somewhat "lacking" in terms of "real world-iness" .. Meaning every serious web application doesnt deal with entities - it uses database functions to collect data and uses database stored procedures to do data manipulation (write, update, delete and so on).
I used EF core powertools to reverse engineer / scaffold the needed functions and stored procedures - which worked surprisingly well. I was able to build my razor page to display and edit and so on.
My problem comes as soon as I want to try the offline-feature of Blazor webassembly. As soon as I try out offline mode the following can be seen: In browsertools/network I see 2 new entries :
3 -> failed net::ERR_FAILED fetch dotnet.5.0.11.js:1
3 -> failed fetch service-worker.js:47
So what can I do to make my Blazor webassembly offline ready, which is the sole reason I/we try out Blazor webassembly ?

Beliar
Автор

Great, I am not using entity framework, could you hint me to logging the error

Ramesh-ewqh
Автор

logger.LogError("no data found in this list"); this error not inserted into db column Exception Message .Why?

prathameshshende
Автор

Thank you for your videos, it's helping me a lot! :)

vovaka
Автор

Continue xamarian form playlist from beginning to advance

codewithroman
Автор

How you do this same in .net 6 because startup.cs is gone and merge with program.cs ?
I tried this but it does not working at all?

Program.cs
var serviceProvider =
var appDBContext =
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddConsole();
builder.AddDebug();
builder.AddProvider(new
});

var app = builder.Build();

emprosenterprises
Автор

cannot access a disposed context instance. a common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. this may occur if you are calling 'dispose' on the context instance, or wrapping it in a using statement. if you are using dependency injection, you should let the dependency injection container take care of disposing context instances. object name: 'applicationdbcontext'.'


This Show Error When Start Application
I work In .net core 6


this my Code
in program.cs


builder.Services.AddScoped<IlogServices, logServices>();
builder.Services.AddScoped<ILogger, DatabaseLogger>();

using (var scope = app.Services.CreateScope())
{
var appDbcontext =
var loggerFactory =
loggerFactory.AddProvider(new
}


whats Soultion Plz

computerscience
Автор

Why did you change this:


for this:


can you explain me that? please

jsebastianrodriguezf
welcome to shbcf.ru