简体   繁体   English

如何在ASP.NET Core中覆盖默认日志记录信息

[英]How to override default logging information in ASP.NET Core

When I start default ASP.NET Core application I got the following lines in console: 当我启动默认的ASP.NET Core应用程序时,在控制台中出现以下行:

Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

Where I can change this logs? 在哪里可以更改此日志?

Those lines are not logged, instead they are printed to the console. 这些行未记录,而是打印到控制台。 What is causing this output is the WebHost.Run() which is the default way to start your application. 导致此输出的是WebHost.Run() ,这是启动应用程序的默认方式。 Or in particular, the internal RunAsync() which sets everything up. 尤其是内部的RunAsync()会设置所有内容。

You cannot change the output without writing that code yourself. 您必须自己编写该代码才能更改输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM