I created the LoggedAttribute class inherited from System.Web.Http.Filters.ActionFilterAttribute and injected logging into the OnActionExecuting and OnActionExecutingAsync ; I assumed that one will be used for asynchronous calls, and one will be used for non-asynchronous calls, but it seems that both of them are used. So what should I put my journal in?
UPDATE
Code follows:
public sealed class LoggedAttribute : ActionFilterAttribute { private readonly ILog _logger; public LoggedAttribute(ILogManager logManager) { _logger = logManager.GetLogger<LoggedAttribute>(); } public LoggedAttribute() : this(new LogManager()) {} public override void OnActionExecuting(HttpActionContext actionContext) {
Then I apply the [Logged] attribute to my base ApiController, and I get duplicate log entries for single calls.
source share