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

'ILoggerFactory' does not contain a definition for 'AddNLog' #161

Closed
AxelAndersen opened this issue Jul 26, 2017 · 4 comments
Closed

'ILoggerFactory' does not contain a definition for 'AddNLog' #161

AxelAndersen opened this issue Jul 26, 2017 · 4 comments
Labels

Comments

@AxelAndersen
Copy link

Hi

I can´t seem to get this to work when adding NLog to my aspnet core application.
I have installed the nuget NLog.Web.AspNetCore and are trying to configure the use of this in my Startup.cs file:

loggerFactory.AddNLog();
env.ConfigureNLog("nlog.config");

I get these errors when building:

'ILoggerFactory' does not contain a definition for 'AddNLog' and no extension method 'AddNLog' accepting a first argument of type 'ILoggerFactory' could be found (are you missing a using directive or an assembly reference?)

and

'IHostingEnvironment' does not contain a definition for 'ConfigureNLog' and no extension method 'ConfigureNLog' accepting a first argument of type 'IHostingEnvironment' could be found (are you missing a using directive or an assembly reference?)

@304NotModified
Copy link
Member

There are some examples here, please check the differences.

@harshane
Copy link

Add these Namespaces to your class
using NLog.Extensions.Logging;
using NLog.Web;

@AxelAndersen
Copy link
Author

AxelAndersen commented Aug 14, 2017

Thanks harshane, its working.
Could you make an answer i can accept?

@304NotModified
Copy link
Member

304NotModified commented Aug 14, 2017

Could you make an answer i can accept?

On Stackoverflow? You can't accept on Github?

Closing this one as solved. Thanks @harshane !

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

No branches or pull requests

3 participants