Ben D
Ben D

Reputation: 811

Asp.net 5 logging not displayed in output window

I believe I have correctly enabled logging in my Asp.net 5 app, with the following code:

Added the following line to my ConfigureServices method in the Startup.cs:

services.AddLogging()

Included the AddDebug() in my Configure method

public void Configure(IApplicationBuilder app, TheWorldContextSeedData seedContext, ILoggerFactory logger)
    {
        logger.AddDebug(LogLevel.Information);

        app.UseStaticFiles();// allow self hosting to use static files i.e. files in the wwwroot

        //listen for mvc requests
        app.UseMvc(config =>
        {
            config.MapRoute(
                name: "Default",
                template: "{controller}/{action}/{id?}",//optional id
                defaults: new { controller = "App", action = "Index" }
                );
        });

        seedContext.EnsureSeedData();
    }

However, I cannot see any information in the output window under Debug. In this case I am looking for logging information in regards to what Entity Framework is doing i.e. Which command it is running.

Any ideas would be very helpful, thanks

Upvotes: 1

Views: 3095

Answers (2)

poke
poke

Reputation: 387507

In this case I am looking for logging information in regards to what Entity Framework is doing i.e. Which command it is running.

The log level for Entity Framework was changed from Information to Debug, as this usually outputs a lot debugging information which isn’t particulary useful in the long run. The new behavior also matches the logging guidelines more properly.

The change was made shortly after the release of beta 7 and was brought up in this issue. Starting with beta 8, you need to set your log level to Debug in order to see the output from Entity Framework. See also this related issue.

Upvotes: 2

Thom Kiesewetter
Thom Kiesewetter

Reputation: 7304

You don't need the line

services.AddLogging. 

Logging is already available from the bootstrap code

You can see debug logging in VS 2015 if you attached to the DNX process or by running the project (F5). See output window and select debug.

There should be a lot of messages about thread exits etc

Upvotes: 0

Related Questions