Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Elmah target to all controllers #15

Open
arc95 opened this issue Jul 7, 2017 · 2 comments
Open

Apply Elmah target to all controllers #15

arc95 opened this issue Jul 7, 2017 · 2 comments

Comments

@arc95
Copy link

arc95 commented Jul 7, 2017

Hi @304NotModified. Is it possible to apply the [Target("Elmah")] attribute to all controllers? I was thinking of adding it via FilterConfig.cs as a global filter:

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
	filters.Add(new HandleErrorAttribute());
	filters.Add(new ElmahTarget());
}

It errored out on the above with this message:

The given filter instance must implement one or more of the following filter interfaces: System.Web.Mvc.IAuthorizationFilter, System.Web.Mvc.IActionFilter, System.Web.Mvc.IResultFilter, System.Web.Mvc.IExceptionFilter, System.Web.Mvc.Filters.IAuthenticationFilter.

Other than to add the attribute to a base controller/class, is it possible to have it applied globally? This would send all NLog log information to Elmah as well for the entire app. Thanks

@304NotModified
Copy link
Member

What's is the namespace of the [Target] I think its a elmah thing?

@arc95
Copy link
Author

arc95 commented Jul 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants