Solve Logging as a Cross-Cutting Concern with MediatR

Solve Logging as a Cross-Cutting Concern with MediatR

Milan Jovanović

1 год назад

25,727 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Viral Spark
Viral Spark - 02.10.2023 17:18

please tell the model domain.shared =Result .which fields inside in it

Ответить
Baffour K. Tonto
Baffour K. Tonto - 29.05.2023 06:11

Is Logging the same as having auditing to keep information about which user performed an operation?

Ответить
Fahimeh Barzegar
Fahimeh Barzegar - 28.04.2023 11:06

Is it just about log in application layer? How can we use this approach to log infrastructure layer, such as repository? Or what is the best way to log them?

Ответить
MuriloMurilo
MuriloMurilo - 08.04.2023 04:14

Where the connection string is stored?

I like your videos! ❤

Ответить
Secundus Praxi
Secundus Praxi - 15.02.2023 21:31

I'm using NLog and I'm confused, It's already in the API project, should I do the same in Application layer?

Also, how can this affect the flow if I have validatorsbehavior too. I hope u can respond thanks a lot!

Ответить
Volodymyr Liashenko
Volodymyr Liashenko - 06.02.2023 17:26

I was expecting to see structure logs as a result and than how to use it and what the benefits of having Structured Logs vs plain logs.

Ответить
Ruben GUINEZ
Ruben GUINEZ - 01.02.2023 20:57

I tested this and the content of class LogginPipelineBehavior is not triggered. I really don't know what happened. Of course I've set up DI and the packages installed. (NET 7)

Ответить
Totti
Totti - 22.01.2023 12:18

Thanks code is on github?

Ответить
Ranga Fernando
Ranga Fernando - 21.01.2023 06:47

Hi Milan,
Thanks for this.
Small clarification. The implementation you did is only covering all the inbound request/response. How about logging outbound request/response.
E.g
Assume we calling a 3rd party application. Want to record what we send and receive in our logs.
Any thought on this?

Ответить
Mehul Bhuva
Mehul Bhuva - 18.01.2023 17:40

Can you cover Microsoft App insights logging

Ответить
Eder Junior DE SOUZA
Eder Junior DE SOUZA - 17.01.2023 23:04

Hello Milan great video, thank you for sharing :)
I was expecting to see something about MediatR, is it coming in a next video or did I miss something in this video ?

Ответить
sergio durval
sergio durval - 17.01.2023 19:22

Your video helped me a lot I'm studying cqrs with mediator and I intend to use this example log in my project
Thanks for sharing knowledge

Ответить
Nazarii
Nazarii - 17.01.2023 18:33

Nice one. For me the biggest problem is always splitting LogEvent ID between different application layers (e.g: new EventId(100, "Unhandled"), new EventId(1001, "Payments"))

Ответить
Adronius
Adronius - 17.01.2023 12:18

I really enjoy your videos! Short, to the point, with great value. It would be great to see the repository. I'd like to learn more on the Result implementation and how the other MediatR classes looks like. Like for example the UpdateProductCommand. Btw, get also some free time, so that you don't burn out. Working on Christmas day is not a good idea ;-)

Ответить
Emerson alves fernandes dos santos
Emerson alves fernandes dos santos - 17.01.2023 03:26

It's perfect how you go right to the point and make it easy to understand. Good job Milan!

Ответить
V U
V U - 14.01.2023 19:03

Amazing video sir, i really enjoy your videos , very concise and and concrete, keep it up!

Ответить
Maor prog
Maor prog - 14.01.2023 09:30

Great tutorial. can you please share with us the code in github? Thanks!

Ответить
Marcus Kaseder
Marcus Kaseder - 14.01.2023 01:57

Why do you add an @ in front of your placeholders?

One thing to mention for logging in general: Even if the logs are disabled by config, the cost is still there.

If we assume that DateTime.UtcNow will take 1 second to execute, it will also take one second when the log level is disabled.

There are some workarounds to avoid this. One is a delegate that only executes if the log level is enabled. Another one is to nest your log into a if that checks the log level and only executes if log level is enabled.

Wanted to mention that because some traces can be cost intensive. That traces are mostly not required in production mode.

Ответить
Gerard Uab
Gerard Uab - 13.01.2023 23:44

Thanks. But how to read logs in production environment during certain period of time?

Ответить
nove
nove - 13.01.2023 23:38

Great video. Similar approach to making exception handling.

Ответить
Aslan Amca
Aslan Amca - 13.01.2023 19:30

I see cqrs and mediatR even when I want to learn another subject. I hate this situation.

Ответить
Scott Leonard
Scott Leonard - 13.01.2023 19:23

Excellent video, as usual. I really like the format, succinctness and detail. Keep up the good work Milan!

Ответить
bugadada
bugadada - 13.01.2023 17:48

Much respect for what you do, keep going!

Ответить
Fernando Calmet
Fernando Calmet - 13.01.2023 17:31

Excellent topic, I was just thinking in the last days how to implement logging with Mediatr. Thank you very much Milan

Ответить
Suleyman Kilinc
Suleyman Kilinc - 13.01.2023 16:13

It would be nice to see you make a video on other ways to manage cross cutting concerns like aspect oriented programming with postsharp(or new metalama) or other similar tools.

Ответить
Richard Haughton
Richard Haughton - 13.01.2023 16:03

Great video again! Could you please make one on logging with ELK stack (Elastic search, LogStash and Kibana) ?

Ответить
saurav bhatta
saurav bhatta - 13.01.2023 15:53

Precise info

Ответить