Windows 服务输出 [英] Windows Service output

查看:20
本文介绍了Windows 服务输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 Windows 服务打印到 stdout 和 stderr 的消息会怎样?我知道他们不会去任何地方,但是他们会下降/dev/null 吗?在这样的写入过程中,应用程序是否可能会阻塞?

What happens to messages printed to stdout and stderr from a Windows service? I know they're not going anywhere, but do they go down /dev/null? Is it possible that an application will block during such a write ?

推荐答案

输出将有效地转到 dev/null,并且不会引入阻塞问题.现在另一方面,性能受到影响,因为它确实需要资源来写出来.

The output will effectively go to dev/null, and won't introduce a blocking issue. Now performance on the other-hand will be impacted, as it does take resources to write it out.

理想情况下,您可以配置日志的结束位置.良好实施的服务将允许:

Ideally, you would be able to configure where logs end up. A nicely implemented service will allow for:

  • 将日志写入以下一项或多项:文件、调试输出、控制台输出(在运行本地实例进行测试/调试时),甚至可能是数据库.
  • 能够指定写入日志文件的路径.
  • 配置日志保留多长时间(服务应该能够清除旧日志以防止硬盘泄漏)
  • 指定启动新文件的频率(这样您就不会得到 18 GB 的日志文件).
  • 理想情况下,您还希望能够配置要记录的数据量(什么级别的详细信息).

这篇关于Windows 服务输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆