在生产中应该使用什么日志监听器? (ASP.NET / 日志应用程序块)

发布于 2024-09-18 06:08:52 字数 247 浏览 7 评论 0原文

我在 ASP.NET 网站中使用 MS Enterprise Logging Application Block。

对于生产启动,我将在以下位置之一设置日志侦听器:

  • Sql Server 数据库
  • Windows 事件日志
  • 文本文件

哪个对性能影响最小?

注意 - 我目前无法切换到 Log4Net 或 ELMAH,所以请不要在您的回复中提出这样的建议。

I'm using MS Enterprise Logging Application Block in an ASP.NET website.

For production launch, I will set up a log listener in one of these locations:

  • Sql Server database
  • Windows event log
  • Text files

Which has the least impact on performance?

NB - I can't switch to Log4Net or ELMAH at this point, so please don't suggest that in your response.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你在我安 2024-09-25 06:08:52

SQL 将为您提供最大的报告灵活性。如果您拥有强大的数据库设置和快速的网络,那么与文本文件相比,它可能不会给您带来太多额外的性能负担。

OTOH,如果您不打算进行大量日志分析,只是在极少数情况下查看日志以找出导致问题的原因,那么文本文件更易于设置和管理。

事件日志是可以的,但是如果您要使用它,请考虑仅在重大错误时使用它,不要用一堆不重要的消息将其弄乱。将其与 SQL 或文本文件结合使用,并将这些重大错误记录到两个位置。

无论您做出什么决定,请在投入生产之前测试其性能。

SQL would give you the most flexibility for reporting. If you have a beefy DB setup and fast network, it might not put much additional perfroamcne burden on you over text files.

OTOH, if you're not planning on doing much log analysis, just looking at logs on rare occassions to figure out what lead to a problem, then text files are simpler to set up and manage.

Event log is ok, but if you're going to use it, consider using it only for significant errors, don't clutter it up with a bunch of unimportant messages. Use it in conjunction with SQL or text files with those significant errors logged to both locations.

Whatever you decide, test it for performance before going into production.

天气好吗我好吗 2024-09-25 06:08:52

我们使用事件日志,这似乎不会影响性能。我无法正确地告诉您每个数据库之间的区别...当它带有数据库时,这取决于情况。数据库是在同一台机器上还是不同的机器上?是跨越半个国家吗?

通常,数据库速度很快,但网络延迟可能会减慢该过程。磁盘 IO 通常也相当快。用于日志记录的磁盘 IO 可能会快速增长,如果将所有日志存储在同一个文件中,则可能不是最佳选择。

另外,请考虑可访问性,即无需访问机器即可更轻松地访问哪一个。该数据库将是该类别中的候选者......

HTH。

We use event log, and that doesn't seem to impact performance. I can't properly tell you the difference between each one... when it comes with a database, it depends. Is the database on the same machine, or a different machine? Is it half-way across the country?

Typically, the database is fast, but network latency can slow down the process. Disk IO is usually pretty fast too. Disk IO for logging can grow rapidly, and might not be the best option if you store all the logs in the same file.

Plus, consider accessibility, which one is easier to access without having to access the machine. The database would be a choice candidate in that category...

HTH.

蓝天 2024-09-25 06:08:52

我最终在产品中使用了此配置:

  1. FormattedDatabaseTraceListener 用于处理严重性为“错误”和“严重”的消息。
  2. 特殊源的平面文件跟踪侦听器,以防日志记录数据库关闭。

任何严重程度较低的事情,我们都不会记录。

I ended up using this configuration in prod:

  1. FormattedDatabaseTraceListener for messages with severity "error" and "critical".
  2. Flat file trace listener for specialSources in case logging database is down.

Anything with lower severity, we are not logging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文