logger.LogError display fail in Console and Error in Debug Output window.

Amit 731 Reputation points
2023-05-29T06:33:45.98+00:00

Hi,

I am using default logger in ASP.NET Core application and use a below super simple line.

logger.LogError("Exception Occur");

Now when I am looking it's output in console. It is displaying log level as fail.

e.g.

fail: ProjectName[0]

Exception Occur

But when I am looking it's output in Debug (VS output window). it is displaying it's log level as Error.

e.g.

ProjectName: Error: Exception Occur

Any reason for this behavior in default logging in asp.net core.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,393 questions
0 comments No comments
{count} votes

Accepted answer
  1. Zhi Lv - MSFT 32,106 Reputation points Microsoft Vendor
    2023-05-30T06:24:44.95+00:00

    Hi @Amit Rawat

    Any reason for this behavior in default logging in asp.net core.

    They are using two kind of logging providers: Console and Debug, so they will use different kind of package (Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Logging.Debug) and formatter to display the logging.

    If you want to customize the logging format, refer to Console log formatting.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Dillion

    0 comments No comments

0 additional answers

Sort by: Most helpful