Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the best practices for error logging in ASP.NET?

When I worked with Java, I used log4j and slf4j in my web projects. I used next scheme:base class for objects, where I can use inheritance, and static class for other situations.

Now I have project on C#(MVC3). What are the best practices for error logging in C# web applications?

like image 492
Frank59 Avatar asked Nov 23 '25 08:11

Frank59


1 Answers

Have a look at log4net. It's similar to log4j (as far as I know) and we're using it all time. It has the ability to be configured via app.config and holds a variety of possibilities to write your logs to (file, rolling file, database, etc.).

Tip: Avoid writing your logs on a network share. We've tried this and we experienced some huge slow-downs for our entire application with this strategy.

like image 137
LazyGeek Avatar answered Nov 26 '25 01:11

LazyGeek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!