Skip to content

Instantly share code, notes, and snippets.

@SamLeach
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamLeach/406ef028816d333e851f to your computer and use it in GitHub Desktop.
Save SamLeach/406ef028816d333e851f to your computer and use it in GitHub Desktop.
HomeController log4mongo
public class HomeController : Controller
{
private readonly ILogger logger;
public HomeController(ILogger logger)
{
XmlConfigurator.Configure();
this.logger = logger;
}
public ActionResult Index()
{
logger.Info("Home");
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
logger.Info("About");
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
logger.Info("Contact");
return View();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment