In the past, I also downloaded my own logging classes and used Console.Writeln (), but in fact there are many good logging options that already exist, so why go there? I use NLog almost everywhere; it is extremely flexible with various log output, including console and file, many log format options and trivially customize versions designed for various .net infrastructures, including compact ones. Starting the installer will add the NLog configuration file settings to the Visual Studio Add New Item dialog. Using in your code is simple:
// declare in your class private static Logger logger = LogManager.GetCurrentClassLogger(); ... // use in your code logger.Debug(() => string.Format("Url: {0}", HttpContext.Current.Request.Url));
source share