监控使用情况统计——如何完成?

发布于 2024-07-11 04:46:27 字数 257 浏览 3 评论 0 原文

Windows、Firefox 或 Google Chrome 都会监控使用统计数据并分析发送给它们的崩溃报告。 我正在考虑在我的应用程序中实现相同的功能。

当然,在应用程序中放置大量日志语句很容易,但这是我想要避免的方法,因为我不希望我的代码在函数中有太多横切关注点。 我正在考虑使用AOP来做到这一点,但在此之前我想先了解一下其他人是如何实现这个功能的。

有人有什么建议吗?

澄清:我正在开发桌面应用程序,不涉及任何 RDBMS

Windows, Firefox or Google Chrome all monitor usage statistics and analyze the crash reports are sent to them. I am thinking of implementing the same feature into my application.

Of course it's easy to litter an application with a lot of logging statement, but this is the approach that I want to avoid because I don't want my code to have too many cross cutting concern in a function. I am thinking about using AOP to do it, but before that I want to know how other people implement this feature first.

Anyone has any suggestion?

Clarification: I am working on desktop application, and doesn't involve any RDBMS

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

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

发布评论

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

评论(3

孤单情人 2024-07-18 04:46:27

Joel 有一篇关于类似内容的博客文章 - 他的应用程序陷阱崩溃,然后联系他的服务器并提供一些详细信息。 我认为他会检查重复项并将其扔掉。 这是一个很棒的系统,当我读到它时给我留下了深刻的印象。

http://www.fogcreek.com/FogBugz/docs/30/UsingFogBUGZtoGetCrashRep。 html

我们在我所在的地方做了这件事,那里设置了一个公共服务器来接收数据。 我不是数据库专家,并且在公共互联网上没有我控制的服务器。 不幸的是,我的个人项目还没有这个强大的功能。

Joel had a blog article about something like this - his app(s) trap crashes and then contact his server with some set of details. I think he checks for duplicates and throws them out. It is a great system and I was impressed when I read it.

http://www.fogcreek.com/FogBugz/docs/30/UsingFogBUGZtoGetCrashRep.html

We did this at a place I was at that had a public server set up to receive data. I am not a db guy and have no servers I control on the public internets. My personal projects unfortunately do not have this great feature yet.

醉生梦死 2024-07-18 04:46:27

在“调试 .Net 2.0 应用程序”中,John Robbins(Wintellect 的)撰写了大量有关如何生成和调试崩溃报告(实际上是 Windbg/SOS 小型转储)的文章。 他的 Superassert 类包含生成这些的代码。 但请注意 - 正确设置需要付出很多努力:符号服务器、源服务器以及对 VS2005 和 Windbg 的良好了解。 然而,他的书将指导您完成整个过程。

关于使用统计,我经常将其与授权联系起来,即用户有权执行特定任务。 过于简单地说,这可能是这样的方法(ApplicationActions 是一个枚举):

public static bool HasPermission( ApplicationActions action )
{
    // Validate user has permission.
    // Log request and result.
}

可以将此方法添加到单例 SercurityService 类中。 正如我所说,这过于简单,但应该表明我想要的服务类型。

In "Debugging .Net 2.0 Applications" John Robbins (of Wintellect) writes extensively about how to generate and debug crash reports (acutally windbg/SOS mini dumps). His Superassert class contains code to generate these. Be warned though - there is a lot of effort required to set this up properly: symbol servers, source servers as well as a good knowledge of VS2005 and windbg. His book, however, guides you through the process.

Regarding usage statistics, I have often tied this into authorisation, i.e. has a user the right to carry out a particular task. Overly simply put this could be a method like this (ApplicationActions is an enum):

public static bool HasPermission( ApplicationActions action )
{
    // Validate user has permission.
    // Log request and result.
}

This method could be added to a singleton SercurityService class. As I said this is overly simple but should indicate the sort of service I have in mind.

多彩岁月 2024-07-18 04:46:27

我将快速浏览一下属于企业库一部分的日志记录应用程序块。 它提供了大量您需要的东西,并且维护得很好。 查看一些可用的场景和示例,我想您会找到您喜欢的。

http://msdn.microsoft.com/en-us/library/cc309506。 ASPX

I would take a quick look at the Logging Application Block that is part of the Enterprise Library. It provided a large number of the things you require, and is well maintained. Check out some of the scenarios and samples available, I think you will find them to your liking.

http://msdn.microsoft.com/en-us/library/cc309506.aspx

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