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

Help adding Logging.EventLog based on ILogger #62

Open
KevHoff2020 opened this issue Mar 21, 2020 · 0 comments
Open

Help adding Logging.EventLog based on ILogger #62

KevHoff2020 opened this issue Mar 21, 2020 · 0 comments

Comments

@KevHoff2020
Copy link

Hi,

I'm new to EF, and I see that it supports logging the SQL queries in EF Core 2.0, so I was trying to add Microsoft.Extensions.Logging.EventLog, but when I install version 2.0.1 (hoping this would be compatible).

The build output shows:
Severity Code Description Project File Line Suppression State
Warning NU1701 Package 'Microsoft.Extensions.Logging.EventLog 2.0.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework 'UAP,Version=v10.0.16299'. This package may not be fully compatible with your project. Inventory.App C:\Users\Owner\Documents\HAIB\Samples\InventorySample-master-dblogger\src\Inventory.App\Inventory.App.csproj 1

Now trying to add the recommended way of creating the logger, the LoggerFactory.Create method is not available.

using Microsoft.Extensions.Logging;

public class DbLogger
{
    public static readonly ILoggerFactory Factory
        = LoggerFactory.Create(builder =>
        {
            builder
                .AddFilter(DbLoggerCategory.Name, LogLevel.Debug)
                .AddEventLog()
                ;
        });
}

Having a DbLogger in this way would be extremely useful so you can see the internal workings of EF core.

Any help would be appreciated.
-Kevin

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

1 participant