[英]How to Run a windows service as console application on client machine
I have a self hosted windows service application with output type as Console application .我有一个自托管的 Windows 服务应用程序,其输出类型为Console 应用程序。 I have added some console logs in that service.
我在该服务中添加了一些控制台日志。 I need to view those logs in console window , without writing log file in local.
我需要在控制台窗口中查看这些日志,而无需在本地写入日志文件。
this i how I do it这就是我的方式
#if DEBUG
var log = new LoggerConfiguration()
.ReadFrom.Configuration(config)
.WriteTo.Console()
.MinimumLevel.Debug()
.CreateLogger();
#else
var log = new LoggerConfiguration().ReadFrom.Configuration(config).CreateLogger();
#endif
Use the Debug.WriteLine in your code and view all these Strings using the DbgView and this will not need the Console to be open.在您的代码中使用Debug.WriteLine并使用DbgView查看所有这些字符串,这不需要打开控制台。
Simple as简单如
System.Diagnostics.Debug.WriteLine("Your Debug String Here");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.