Logging

NLog for MVC - How to Log the Machine Name and the Client IP Address in NLog

In a previous post, I went through the steps to  configure NLog for MVC   web application. In the following tip I will show you the steps to log the client IP address and the machine name: Step 1: Installing NLog.Web NLog.Web is an extension that e xtend NLog with targets and layout renderers for websites and web applications. It  can be downloaded from   NuGet .  You can u se the GUI or the following command in the Package Manager Console: …

Configure NLog for ASP.NET MVC in 3 Steps

Error Logging is one of the key attributes when developing ASP.NET Web application. NLog is a great open-source logging tool that allows developers to easily and efficiently implement logging framework. In this post, I will show the steps needed to configure and use NLog in your MVC web application. Step 1: Installing NLog (NLog Config) NLog can be downloaded from  NuGet .  You can use the GUI or the following command in the Package Manager Console: PM> Install-Package NLog -Version 4.4 .1 That'…

Delete Log Files That Are Older Than 6 Months

I'm using NLog in most of the web applications that I built. This library generates files with extension ".log" where the exceptions and tracing logs are stored.  After, few months to years, I noticed that few applications reached a large number of log files generated over the time and this is totally normal especially if we are tracing major events in the application. The files are consuming some good space of the hard disk. Therefore, there is a need to delete old files and cleanup the hard d…

Configure log4net logging framework for ASP.NET MVC

This post will provide a short overview of the steps needed to integrate the  Apache log4net  logging framework to an ASP.NET MVC Web application: Include the log4net in your MVC project, you can use the  NuGet  package manager (Alternatively, you can also download and add the  log4net.dll  reference manually): PM> install-package Log4Net Add the following tags to the MVC  Web.config  file: < configuration > < configSections > [...] < section name = "log4net&…

Load More
That is All