RehanSaeed / rehansaeed.github.io

Muhammad Rehan Saeed's Blog
https://rehansaeed.com
30 stars 6 forks source link

[Comment] Logging with Serilog.Exceptions #85

Open RehanSaeed opened 4 years ago

RehanSaeed commented 4 years ago

https://rehansaeed.com/logging-with-serilog-exceptions/

RehanSaeed commented 4 years ago

Manav Ghosh Manav Ghosh commented on 2016-04-01 09:51:48

Hi, Is there a way I can configure Serilog.Exceptions settings in a web.config or app.config file. Kindly help me with some sample settings.

RehanSaeed commented 4 years ago

Muhammad Rehan Saeed Muhammad Rehan Saeed commented on 2016-04-01 10:23:25

Hi, Is there a way I can configure Serilog.Exceptions settings in a web.config or app.config file. Kindly help me with some sample settings.

The only thing you can configure in Serilog.Exceptions is to add other custom exceptions, so that they are serialized faster and this needs to be done in code.

Serilog itself, which is a separate project has a method of using config.

RehanSaeed commented 4 years ago

Mike Breytenbach Mike Breytenbach commented on 2016-10-16 20:26:05

Amazing post! Thanks so much.

RehanSaeed commented 4 years ago

preguntoncojonero preguntoncojonero commented on 2016-11-03 21:27:03

Full source code c# app using Serilog in GitHub? real world

And Serilog + ELK (kibana) ?

RehanSaeed commented 4 years ago

Muhammad Rehan Saeed Muhammad Rehan Saeed commented on 2016-11-04 09:36:36

Full source code c# app using Serilog in GitHub? real world

And Serilog + ELK (kibana) ?

I use Serilog + ELK in my company but obviously can't show you that. If you want blog posts, Google it, I've seen blog posts about people using Serilog and Seq and many blog posts out there about people using ELK and Serilog separately. If you want GitHub examples, you can do an advanced search for Serilog across all repositories.

RehanSaeed commented 4 years ago

Preguntoncojonero Preguntoncojonero commented on 2017-03-29 12:36:31

Thanks a lot for your big efforts. You're right.

In your real projects, NOT USE log4net, NLog and Microsoft's Logging Application Block. ONLY USE Serilog (and Serilog.Exceptions) to generate structured data file. Optionally, you can store all your logs in ELK stack, isn't?

IMHO, better samples for minimize learning curve are real applications with full source code and good patterns and practices. Full source code sample REAL application? not Demo, only real applications? I think, the better, full real samples in github+codeplex+codeproject with full source code and using good patterns and practices: "advanced search across all repositories", better if anyone knows a good project with patterns.

Googling I have a BIG BANG FAT repository of links and infinitum code. Really.

Mindly notes:

main influences, are full of innovative ideas that can free our minds to explore new techniques, patterns and paradigms.

You want to use technologies that allow for rapid development, constant iteration, maximal efficiency, speed, robustness and more. You want to be lean and you want to be agile. You want to use technologies that will help you succeed in the short and long term. And those technologies are not always easy to pick out.

Mindly notes 2: You have REAL experienced.

About it Serilog + NET Apps (optional EL-Kibana), any step-by-step guide, or Getting Started - Quick Start that can be completed in 15-20 minutes?

I get you a good step-by-step guide sample like https://berniecook.wordpress.com/2013/01/13/getting-started-with-git-and-visual-studio-step-by-step-guide/

I wanted to quickly cover off several assumptions before we get started: install (requisites, tools required), configure, and running quickly. Target will be an "go and ready" sample.

RehanSaeed commented 4 years ago

Steve Graddy Steve Graddy commented on 2017-05-15 17:15:45

Was having issue with Serilog.Extensions.Logging and Serilog.Sinks.MSSqlServerCore in ASP.NET Core 1.1 writing to database, it created logs table with no issue but would not write data. Finally got SerilogSelfLog working and was able to determine that the issue was the exception value was always null even though I know I am passing an exception object in the logger.LogError("my error", ex). Fixed the database column by allowing nulls and not I get data in table but the Exception column never gets any values. Looks like same issue within the rollingFile output (EX: 2017-05-15 08:06:52.471 -05:00 [Error] my error ). All the logging seems to be working now except I have no exception or exception details logged anywhere although the Error line or row in database is written. So I added your Serilog.Exceptions to my ASP.NET Core 1.1 Serilog setup as you describe above and I am still not seeing any exception or exception details logged in either the RollingFile or the MSSQL Server database. Have you any idea as to what might be happening.

RehanSaeed commented 4 years ago

Muhammad Rehan Saeed Muhammad Rehan Saeed commented on 2017-05-18 15:22:25

Was having issue with Serilog.Extensions.Logging and Serilog.Sinks.MSSqlServerCore in ASP.NET Core 1.1 writing to database, it created logs table with no issue but would not write data. Finally got SerilogSelfLog working and was able to determine that the issue was the exception value was always null even though I know I am passing an exception object in the logger.LogError("my error", ex). Fixed the database column by allowing nulls and not I get data in table but the Exception column never gets any values. Looks like same issue within the rollingFile output (EX: 2017-05-15 08:06:52.471 -05:00 [Error] my error ). All the logging seems to be working now except I have no exception or exception details logged anywhere although the Error line or row in database is written. So I added your Serilog.Exceptions to my ASP.NET Core 1.1 Serilog setup as you describe above and I am still not seeing any exception or exception details logged in either the RollingFile or the MSSQL Server database. Have you any idea as to what might be happening.

https://github.com/RehanSaeed/Serilog.Exceptions/issues/21

RehanSaeed commented 4 years ago

mohammad mohammad commented on 2019-05-27 19:27:59

That's cool