Search code examples
c#asp.netsql-servervisual-studioevent-log

Event Logging in ASP.NET


I am using VS2005 C# .NET 2.0 and SQL Server 2005.

Are there any websites that provide step by step instructions to implement event logging for my web application?

Edit:

I will like to save the log event files as a text file in the application folder.

As my web application does login, validations and checks between several SQL databases, as well as import and export of data from SQL databases. I would like to log the events above in text files.


Solution

  • I routinely use Log4Net from Apache (free).

    The Apache log4net library is a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent Apache log4j™ framework to the Microsoft® .NET runtime. We have kept the framework similar in spirit to the original log4j while taking advantage of new features in the .NET runtime.

    There is excellent documentation and it is widely used. This blog post has a nice, simple walkthrough.

    A big advantage of Log4Net is that it allows you to record to multiple log destinations including text files,, the event log, SQL Server and many others.