Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the LoggerFactory log console in ASP.NET Core 1.0 for a web app?

So I have this in my Startup.cs by default:

loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();

How do I see the console the loggerFactory is adding? I can see the logging info in the Debug output window, but it's very muddled with the rest of automatic debug information and hard to find.

Is there a way to view the logger console or if not, a way to display the information that only I log in Output?

like image 435
Daath Avatar asked Mar 17 '16 17:03

Daath


People also ask

How do I view .NET Core logs?

The . NET Core agent logs information to the logs folder within C:\ProgramData\Contrast\dotnet-core\ on Windows or /var/tmp/contrast/dotnet-core/ on Linux, by default. Notes: Depending on the setup of the Windows profile and folder view settings, the ProgramData folder may be hidden.

Where can I find asp net logs?

logs files could show up in a few places. Your web traffic will show up where defined in your IIS configuration (default is c:\windows\system32\logfiles\[application id]\ ). . net error codes show up in your event viewer (start > run > eventvwr) under applications.

Where does ILogger write to?

ILogger offers provider-based functionality to write to the console, the debug window, the Windows Event Log, to Microsoft Azure Ap Services diagnostics and logs, as well as to the TraceSource and the EventSource.


1 Answers

To display less clutter generated by the Framework in the Debug Window you can select which aspects are logged.

In particular I turn off "Module Load Messages" as that is the bulk of the messages (in VS 2015). Also, "Thread Exit Messages" are another to consider turning off.

Tools -> Options -> Debugging -> Output Window:

"Module Load Messages" logging options in Visual Studio 2015

like image 98
K Scandrett Avatar answered Nov 06 '22 23:11

K Scandrett