.net 的错误报告框架

发布于 2024-08-14 17:39:11 字数 267 浏览 3 评论 0原文

您是否建议在 .net 中使用错误报告框架?我需要诸如电子邮件报告之类的可能性,并将文件附加到电子邮件中。用户应该能够向报告添加信息,并且还应该能够删除报告文件,即如果它们包含隐私关键数据。还应该有可能进行自动屏幕截图。 所需的框架还应包括错误报告图形用户界面。它应该使我能够创建自己的用于错误报告的图形用户界面。

我已经使用 log4net,但据我所知,不可能向用户显示用于错误报告的 GUI。

如果有任何建议,那就太好了,

问候,马丁

is there an error-reporting-framework you would suggest for use in .net. I need possibilities like e-mail-reporting with fileappending to e-mail. The user should have the possibility to add information to the report and also should have the possibility to remove report-files, i.e. if they contains privacy-critical data. There also should be a possibility of taking an automated screenshot.
The needed framework should also include error-reporting guis. It should give me the possibility to create own guis for error-reporting.

I already use log4net, but there it isn't possible, as far as i know, to show a gui for error-reporting to the user.

Would be nice if there are any advices,

Greetings, Martin

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

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

发布评论

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

评论(9

萌︼了一个春 2024-08-21 17:39:11

您尝试过 Elmah 吗?它执行您正在谈论的所有错误处理元素。您可以查看 Trac 来查找您想要的错误跟踪位。

善良,

Have you tried Elmah? It does all the error handling elements you are talking of. You might look at Trac for the bug-tacking bits you want.

Kindness,

Dan

中性美 2024-08-21 17:39:11

我熟悉“Microsoft Enterprise Library Logging Block”和“Log4Net”,这两个都符合您的要求(具有多个日志侦听器)
这是比较这两个的页面: http://weblogs .asp.net/lorenh/archive/2005/02/18/376191.aspx

I am familiar with the "Microsoft Enterprise Library Logging Block" and "Log4Net" and both of these fit into your requirements (having multiple log listeners)
Here is a page that compares these two: http://weblogs.asp.net/lorenh/archive/2005/02/18/376191.aspx

谢绝鈎搭 2024-08-21 17:39:11

推出您自己的异常处理程序。在您的program.cs 类中使用以下代码。出现异常时会自动发送邮件。

using System;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Threading; 

namespace ExceptionHandlerTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);

            // Your designer generated commands.
        }

        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) 
        {

            var fromAddress = new MailAddress("your Gmail address", "Your name");
            var toAddress = new MailAddress("email address where you want to receive reports", "Your name");
            const string fromPassword = "your password";
            const string subject = "exception report";
            Exception exception = e.Exception;
            string body = exception.Message + "\n" + exception.Data + "\n" + exception.StackTrace + "\n" + exception.Source;

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                //You can also use SendAsync method instead of Send so your application begin invoking instead of waiting for send mail to complete. SendAsync(MailMessage, Object) :- Sends the specified e-mail message to an SMTP server for delivery. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes. 
                smtp.Send(message);
            }
        }
    }
}

Roll your own exception handler. Use below code in your program.cs class. It will automatically Send mail when exception occurs.

using System;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Threading; 

namespace ExceptionHandlerTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);

            // Your designer generated commands.
        }

        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) 
        {

            var fromAddress = new MailAddress("your Gmail address", "Your name");
            var toAddress = new MailAddress("email address where you want to receive reports", "Your name");
            const string fromPassword = "your password";
            const string subject = "exception report";
            Exception exception = e.Exception;
            string body = exception.Message + "\n" + exception.Data + "\n" + exception.StackTrace + "\n" + exception.Source;

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                //You can also use SendAsync method instead of Send so your application begin invoking instead of waiting for send mail to complete. SendAsync(MailMessage, Object) :- Sends the specified e-mail message to an SMTP server for delivery. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes. 
                smtp.Send(message);
            }
        }
    }
}
反目相谮 2024-08-21 17:39:11

查看 The Object Guy 制作的日志框架

Check out the logging framework made by The Object Guy

嗼ふ静 2024-08-21 17:39:11

Red Gate 有一个名为 SmartAssembly 的产品,它可以进行错误报告。我自己没用过,不过这家公司口碑不错。

Red Gate has a product called SmartAssembly that does error reporting. I haven't used it myself, but the company has a good reputation.

老街孤人 2024-08-21 17:39:11

检查企业库,您有一个日志记录和异常处理应用程序日志完全可配置和可扩展。

Check the Enterprise Library, you have a logging and an exception handling application log fully configurable and extensible.

若无相欠,怎会相见 2024-08-21 17:39:11

Microsoft WER,但是您需要在 Winqual 注册并且您的公司需要拥有 VeriSign ID。对很多人来说太麻烦了。

There is Microsoft WER, however you need to register at Winqual and your company needs to have a VeriSign ID. Too much a hassle for many people.

他夏了夏天 2024-08-21 17:39:11

Microsoft 的企业库,最新版本4.1-October 2008 广泛用于异常处理和日志记录等。还有一个很好的 GUI 构建器,可以修改您的 app.config 或 web.config 文件。

Microsoft's Enterprise Library, latest version 4.1-October 2008 is widely used for Exception handling and logging among other things. There's also a nice GUI builder that will modify your app.config or web.config file.

送君千里 2024-08-21 17:39:11

您还可以尝试 log4net。不过,我不确定是否可以通过电子邮件发送。然而,它是可扩展的。另外,您还可以获得源代码!

You can also try log4net. I'm not sure about emailing, though. However, it is extensible. Plus you can get the source code!

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