public void SubmitFaultReport(FaultReport report)
        {
            // get the log file data
            var    rootAppender = ((Hierarchy)LogManager.GetRepository()).Root.Appenders.OfType <FileAppender>().FirstOrDefault();
            string filename     = rootAppender != null ? rootAppender.File : string.Empty;

#if DEBUG
            string serviceFilename = @"C:\Windows\Temp\GwupeService_Dev.log";
#else
            string serviceFilename = @"C:\Windows\Temp\GwupeService.log";
#endif
            if (!String.IsNullOrEmpty(filename))
            {
                try
                {
                    var request = new FaultReportRq
                    {
                        report   = report.UserReport,
                        subject  = report.Subject,
                        version  = Version(3),
                        platform = Environment.OSVersion.ToString()
                    };
                    try
                    {
                        request.log = Convert.ToBase64String(ExtractLog(filename));
                    }
                    catch (Exception e)
                    {
                        Logger.Error("Failed to extract log from " + filename, e);
                        request.report += "\n\n\nFailed to extract log from " + filename;
                    }
                    try
                    {
                        request.serviceLog = Convert.ToBase64String(ExtractLog(serviceFilename));
                    }
                    catch (Exception e)
                    {
                        Logger.Error("Failed to extract log from " + serviceFilename, e);
                        request.report += "\n\n\nFailed to extract log from " + filename;
                    }
                    try
                    {
                        var response = ConnectionManager.Connection.Request <FaultReportRq, FaultReportRs>(request);
                    }
                    catch (Exception e)
                    {
                        Logger.Error("Failed to send fault report to server", e);
                    }
                }
                catch (Exception e)
                {
                    Logger.Error("Failed to read the log file", e);
                }
            }
            else
            {
                Logger.Error("Failed to get the log file, cannot submit fault.");
            }
        }
        public void GenerateFaultReport()
        {
            FaultReport report = UIManager.GenerateFaultReport();

            // Submit the report in the background
            if (report != null)
            {
                ThreadPool.QueueUserWorkItem(state => SubmitFaultReport(report));
            }
        }
Example #3
0
 public void SubmitFaultReport(FaultReport report)
 {
     // get the log file data
     var rootAppender = ((Hierarchy)LogManager.GetRepository()).Root.Appenders.OfType<FileAppender>().FirstOrDefault();
     string filename = rootAppender != null ? rootAppender.File : string.Empty;
     #if DEBUG
     string serviceFilename = @"C:\Windows\Temp\GwupeService_Dev.log";
     #else
     string serviceFilename = @"C:\Windows\Temp\GwupeService.log";
     #endif
     if (!String.IsNullOrEmpty(filename))
     {
         try
         {
             var request = new FaultReportRq
             {
                 report = report.UserReport,
                 subject = report.Subject,
                 version = Version(3),
                 platform = Environment.OSVersion.ToString()
             };
             try
             {
                 request.log = Convert.ToBase64String(ExtractLog(filename));
             }
             catch (Exception e)
             {
                 Logger.Error("Failed to extract log from " + filename, e);
                 request.report += "\n\n\nFailed to extract log from " + filename;
             }
             try
             {
                 request.serviceLog = Convert.ToBase64String(ExtractLog(serviceFilename));
             }
             catch (Exception e)
             {
                 Logger.Error("Failed to extract log from " + serviceFilename, e);
                 request.report += "\n\n\nFailed to extract log from " + filename;
             }
             try
             {
                 var response = ConnectionManager.Connection.Request<FaultReportRq, FaultReportRs>(request);
             }
             catch (Exception e)
             {
                 Logger.Error("Failed to send fault report to server", e);
             }
         }
         catch (Exception e)
         {
             Logger.Error("Failed to read the log file", e);
         }
     }
     else
     {
         Logger.Error("Failed to get the log file, cannot submit fault.");
     }
 }