Cleanup and fixes

This commit is contained in:
2013-01-12 14:58:33 -05:00
parent bc019923d2
commit e50052d41e
27 changed files with 240 additions and 156 deletions
+3 -2
View File
@@ -9,15 +9,16 @@ namespace MileageTraker.Web.Attributes
{
if (filterContext != null)
{
// TODO: capture current user
var controller = filterContext.RouteData.Values["controller"].ToString();
var action = filterContext.RouteData.Values["action"].ToString();
var username = filterContext.HttpContext.User.Identity.Name;
var loggerName = string.Format("{0}Controller.{1}", controller, action);
var @params = string.Join(", ", filterContext.ActionParameters.Select(i => i.Key + ": " + i.Value));
var hostAddress = "UserHostAddress: " + filterContext.HttpContext.Request.UserHostAddress;
log4net.LogManager.GetLogger(loggerName).Info(hostAddress + ", " + @params);
log4net.LogManager.GetLogger(loggerName)
.InfoFormat("{0}, username: {1}, {2}", hostAddress, username, @params);
}
base.OnActionExecuting(filterContext);
}