Application Error Log In Asp.net
Working with Multiple Environments Hosting Managing Application State Servers Request Features Open Web Interface for .NET (OWIN) Choosing the Right .NET For You on the Server MVC Testing Working with Data Client-Side Development Mobile Publishing and Deployment Guidance for Hosting Providers Security Performance Migration API Contribute ASP.NET Docs » Fundamentals » Logging Edit on GitHub Logging¶ By Steve Smith ASP.NET Core has built-in support for logging, and allows developers to easily leverage their preferred logging framework's functionality as well. Implementing logging in your application requires a minimal amount of setup code. Once this is in place, logging can be added wherever it is desired. Sections: Implementing Logging in your Application Configuring Logging in your Application Logging Recommendations Summary View or download sample code Implementing Logging in your Application¶ Adding logging to a component in your application is done by requesting either an ILoggerFactory or an ILogger
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company http://stackoverflow.com/questions/5531859/error-logging-in-a-asp-net-webapplication Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error Logging in a ASP.NET WebApplication up vote 1 down vote favorite If an exception occurs, it should be logged to application error a text file. And that the user should be redirected to a page that explains the error to the user. Where do I start? c# asp.net error-handling error-logging share|improve this question edited Apr 3 '11 at 19:28 asked Apr 3 '11 at 19:21 user478636 1,268123166 1 Sure. What's your question? –James Skemp Apr 3 '11 at 19:22 Use a try - catch block. Configure the location of file in web.config and application error log add the file parameters with the try - catch block. –nandu.com Apr 3 '11 at 19:27 Actually, I need to log the error to a textfile. –user478636 Apr 3 '11 at 19:28 Do you want each exception to be logged to its own unique file? Or would you prefer that all exceptions be logged to one file? –Jim Scott Apr 3 '11 at 23:45 Either way it will be fine.... but i most likely prefer it be just 1 file –user478636 Apr 4 '11 at 5:23 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote accepted I'd recommend using log4net. It's very easy to get this in place. First, download log4net. Unzip this, and add a reference to log4net.dll in your project. Create a basic config file named log4net.config in your root folder. This will log errors in log files named by date in the Logs folder outside of your web root.