private void LogError(Exception exception) { if (testDatabase == null) { return; } ErrorLogEntry error = new ErrorLogEntry(); var exceptionStackTrace = new ExceptionStackTrace(exception); error.CommandLine = Environment.CommandLine; error.ExceptionMessage = exceptionStackTrace.Message; error.ExceptionType = exception.GetType().FullName; error.ExceptionSource = exceptionStackTrace.Source; error.ExceptionStackTrace = exceptionStackTrace.StackTrace; error.FileName = exceptionStackTrace.FileName; error.HostName = System.Environment.MachineName; error.IPAddress = Utils.GetLocalIP().GetAddressBytes(); error.LineNumber = exceptionStackTrace.LineNumber; error.ProcessID = Process.GetCurrentProcess().Id; error.TestID = testDatabase.GetCurrentTestID(); testDatabase.LogError(error); }
public void MarkCurrentFixed() { currentErrors.Remove(currentError); currentError = null; NextError(); UpdateErrorCount(); }
public void PrevError() { if (currentErrors.Count <= 0) { return; } if (currentErrorIndex <= 0) { return; } currentErrorIndex--; currentError = currentErrors[currentErrorIndex]; if (currentError == null) { return; } errorBodyText.SetText(currentError.errorDesc); if (!timeline.paused) { timeline.TogglePlayback(); } float time = timeline.BeatsToDuration(0.0f, currentError.beatTime, Timeline.BeatDurationDirection.Forward); // timeline.SetBeatTime(time); StartCoroutine(timeline.AnimateSetTime(time)); }
public override string Log(Error error) { var id = Guid.NewGuid(); var entry = new ErrorLogEntry(this, id.ToString(), error.CloneObject()); _entries.Add(entry); return(entry.Id); }
private static void ReportErrorStringLookupFailure(int firmwareVersion, ErrorLogEntry errorLogEntry, string detail) { System.Diagnostics.Debug.WriteLine("Failed to locate error string."); System.Diagnostics.Debug.WriteLine(" FW version: " + firmwareVersion); System.Diagnostics.Debug.WriteLine(" LogId: " + errorLogEntry.LogId); System.Diagnostics.Debug.WriteLine(" Line Number: " + errorLogEntry.LineNumber); System.Diagnostics.Debug.WriteLine(" Reason: " + detail); }
public void Add(ErrorLogEntry entry) { if (this.Count == this._size) { base.BaseRemoveAt(0); } base.BaseAdd(entry.Id, entry); }
public ErrorLoggedEventArgs(ErrorLogEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } _entry = entry; }
public override ErrorLogEntry GetError(string id) { var errorDoc = _elasticClient.Get<ErrorDocument>(x => x.Id(id)); errorDoc.VerifySuccessfulResponse(); var error = ErrorXml.DecodeString(errorDoc.Source.ErrorXml); error.ApplicationName = ApplicationName; var result = new ErrorLogEntry(this, id, error); return result; }
/// <summary> /// Logs an exception and its context to the error log. /// </summary> protected virtual ErrorLogEntry LogException(Exception e, HttpContext context) { if (e == null) { throw new ArgumentNullException("e"); } // // Fire an event to check if listeners want to filter out // logging of the uncaught exception. // ExceptionFilterEventArgs args = new ExceptionFilterEventArgs(e, context); OnFiltering(args); if (args.Dismissed) { return(null); } // // Log away... // ErrorLogEntry entry = null; try { Error error = new Error(e, context); ErrorLog log = GetErrorLog(context); error.ApplicationName = log.ApplicationName; string id = log.Log(error); entry = new ErrorLogEntry(log, id, error); } catch (Exception localException) { // // IMPORTANT! We swallow any exception raised during the // logging and send them out to the trace . The idea // here is that logging of exceptions by itself should not // be critical to the overall operation of the application. // The bad thing is that we catch ANY kind of exception, // even system ones and potentially let them slip by. // Trace.WriteLine(localException); } if (entry != null) { OnLogged(new ErrorLoggedEventArgs(entry)); } return(entry); }
/// <summary> Is invoked when a list viewer item has been double clicked. </summary> /// <param name="sender">Event sender</param> /// <param name="selectionEventArgs">Event arguments</param> private void OnSelectionDoubleClicked(object sender, SelectionEventArgs selectionEventArgs) { ErrorLogEntry entry = selectionEventArgs.Selection as ErrorLogEntry; if (entry == null) { return; } MessageDialog.ShowException(entry.Exception, entry.Message); }
public override ErrorLogEntry GetError(string id) { var errorDoc = _elasticClient.Get <ErrorDocument>(id).VerifySuccessfulResponse(); var error = ErrorXml.DecodeString(errorDoc.Source.ErrorXml); error.ApplicationName = ApplicationName; var result = new ErrorLogEntry(this, id, error); return(result); }
public override ErrorLogEntry GetError(string id) { var document = _elasticClient.Get <ErrorDocument>(id); var error = ErrorXml.DecodeString(document.ErrorXml); error.ApplicationName = ApplicationName; var result = new ErrorLogEntry(this, id, error); return(result); }
public ErrorLogEntryWrapper(ErrorLogEntry entry) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } Log = entry.Log; Id = entry.Id; Error = new ErrorWrapper(entry.Error, entry.Log.SourcePaths); }
/// <inheritdoc /> public ImageDescriptor GetImage(object element, ColumnDescriptor column) { if (column != ErrorsViewListContentProvider.MessageColumn) { return(null); } ErrorLogEntry item = (ErrorLogEntry)element; return(item.LogEntryType == ELogEntryType.Error ? ErrorImage : WarningImage); }
internal static void Add(ErrorLogEntry entry) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } if (entry.Error.Exception == null) { throw new ArgumentException(null, nameof(entry)); } Table.Add(entry.Error.Exception, entry); }
public void Add(ErrorLogEntry entry) { lock (lockObject) { if (list.Count == size) { list.RemoveAt(0); } list.Add(entry); } }
//private string GetFormattedErrorDescription(Error currentError) //{ // //throw new Exception("Could not get error description."); // string pageName = string.Empty; // if (Request.UrlReferrer != null) // pageName = System.IO.Path.GetFileName(Request.UrlReferrer.Query); // return pageName + ": " + currentError.Type + ": " + currentError.Message; //} private string GetFormattedExtraInformation(ErrorLogEntry entry, string userMessage) { var errorLogRelativeUrl = Url.Content(String.Format("~/elmah/detail?id={0}", entry.Id)); var extra = Server.HtmlEncode(GetExtraInformation(userMessage)); var protocol = Request.IsSecureConnection ? "https://" : "http://"; extra += Environment.NewLine; extra += String.Format("Url to errorlog: {0}{1}{2} .", protocol, Request.Url.Host, errorLogRelativeUrl); extra += Environment.NewLine; extra += "In web app: Admin BigLamp -> Error Log"; return(extra); }
public void NextError() { //Deselect any previous targets if (currentError != null) { foreach (Target target in currentError.affectedTargets) { target.Deselect(); } } if (currentErrors.Count <= 0) { return; } if (currentErrorIndex >= currentErrors.Count - 1) { return; } currentErrorIndex++; currentError = currentErrors[currentErrorIndex]; if (currentError == null) { return; } errorBodyText.SetText(currentError.errorDesc); if (!timeline.paused) { timeline.TogglePlayback(); } //timeline.JumpToX(currentError.beatTime); float time = timeline.BeatsToDuration(0.0f, currentError.beatTime, Timeline.BeatDurationDirection.Forward); StartCoroutine(timeline.AnimateSetTime(time)); //Select the targets foreach (Target target in currentError.affectedTargets) { target.Select(); } }
protected override async Task LoadContentsAsync(IOwinContext context) { var errorId = context.Request.Query["id"]; errorLogEntry = await ErrorLog.GetErrorAsync(errorId); if (errorLogEntry == null) { PageTitle = "Error not found in log"; return; } PageTitle = $"Error: {errorLogEntry.Error.TypeName} [{errorLogEntry.Id}]"; requestQuery = context.Request.Uri.Query; }
public ErrorLogEntry Create(DateTime timeStamp, string message, string stackTrace, string data, ErrorSeverity severity) { var errorLog = new ErrorLogEntry { Timestamp = timeStamp, Message = message, Stacktrace = stackTrace, Data = data, Severity = severity }; _dbContext.Add(errorLog); return(errorLog); }
public ErrorLogEntry Create(DateTime timeStamp, string message, string stackTrace, string data, ErrorSeverity severity) { var errorID = 0; _sqlObjectFactory.GetConnection().Using(connection => errorID = connection.QuerySingle <int>("INSERT INTO pf_ErrorLog (TimeStamp, Message, StackTrace, Data, Severity) VALUES (@TimeStamp, @Message, @StackTrace, @Data, @Severity);SELECT CAST(SCOPE_IDENTITY() as int)", new { TimeStamp = timeStamp, Message = message, StackTrace = stackTrace, Data = data, Severity = severity })); var errorLog = new ErrorLogEntry { ErrorID = errorID, TimeStamp = timeStamp, Message = message, StackTrace = stackTrace, Data = data, Severity = severity }; return(errorLog); }
private ErrorLogEntry MapErrorOverviewEntry(MessageOverview message) { var error = new Error { ApplicationName = message.Application, Detail = message.Detail, HostName = message.Hostname, Message = message.Title, Source = message.Source, StatusCode = message.StatusCode ?? 0, Time = message.DateTime.Value, Type = message.Type, User = message.User, }; var errorLogEntry = new ErrorLogEntry(this, message.Id, error); return(errorLogEntry); }
/// <inheritdoc /> public string GetText(object element, ColumnDescriptor column) { ErrorLogEntry item = (ErrorLogEntry)element; if (column == ErrorsViewListContentProvider.MessageColumn) { return(item.Message); } if (column == ErrorsViewListContentProvider.PluginColumn) { return(item.PluginName); } if (column == ErrorsViewListContentProvider.DateColumn) { return(item.Timestamp.ToString()); } return(null); }
protected virtual void LogException(Exception e, HttpContext context) { e.AssertNotNull("e"); // Fire an event to check if listeners want to filter out // logging of the uncaught exception. var args = new ExceptionFilterEventArgs(e, context); OnFiltering(args); if (args.Dismissed) { return; } //Run the module ErrorLogEntry entry = null; try { var error = new Error(e, context); new ErrorHandlerDelegate(err => new CustomErrorHandler() { Configuration = SettingsManager.Config }.HandleError(err))(error); } catch (Exception localException) { // // IMPORTANT! We swallow any exception raised during the // logging and send them out to the trace . The idea // here is that logging of exceptions by itself should not // be critical to the overall operation of the application. // The bad thing is that we catch ANY kind of exception, // even system ones and potentially let them slip by. Trace.WriteLine(localException); } if (entry != null) { OnLogged(new ErrorLoggedEventArgs(entry)); } }
protected virtual void LogInternal(Error error, object context) { ErrorLogEntry entry = null; try { var errorLog = ErrorLog.GetDefault((HttpContext)context); string errorId = errorLog.Log(error); entry = new ErrorLogEntry(errorLog, errorId, error); } catch (Exception ex) { Trace.WriteLine(ex); } finally { if (entry != null) { this.OnLogged(this, new ErrorLoggedEventArgs(entry)); } } }
/// <summary> /// Gets an error string given an error log entry and a raw firmware version. /// </summary> /// <param name="rawFirmwareVersion">The raw current firmware version from a Locutus device.</param> /// <param name="errorLogEntry">An error log entry to convert to a more meaningful error message.</param> /// <returns>An error string describing the issue described by <paramref name="errorLogEntry"/>.</returns> internal string GetErrorString(int rawFirmwareVersion, ErrorLogEntry errorLogEntry) { var errorString = string.Empty; IDictionary <int, IDictionary <int, int> > firmwareVersionEntries; if ((ErrorMaps != null) && ErrorMaps.TryGetValue(errorLogEntry.LogId, out firmwareVersionEntries)) { var firmwareVersionKey = GetFirmwareVersionForLookup(rawFirmwareVersion); IDictionary <int, int> lineNumberToErrorString; if (firmwareVersionEntries.TryGetValue(firmwareVersionKey, out lineNumberToErrorString)) { int errorStringIndex; if (lineNumberToErrorString.TryGetValue(errorLogEntry.LineNumber, out errorStringIndex) && (errorStringIndex >= 0) && (errorStringIndex < Strings.Count)) { try { errorString = INTV.Core.Utility.StringUtilities.SPrintf(Strings[errorStringIndex], errorLogEntry.ErrorDetails); } catch (Exception e) { // Don't care if this fails. ReportErrorStringLookupFailure(rawFirmwareVersion, errorLogEntry, "Failed to format output" + "; " + e.Message); } } else { ReportErrorStringLookupFailure(rawFirmwareVersion, errorLogEntry, "Failed to look up line number"); } } else { ReportErrorStringLookupFailure(rawFirmwareVersion, errorLogEntry, "Failed to locate data for firmware revision"); } } else { ReportErrorStringLookupFailure(rawFirmwareVersion, errorLogEntry, "Failed to locate database for log kind"); } return(errorString); }
private static void RenderError(TextWriter writer, ErrorLogEntry entry, Uri baseUrl) { Debug.Assert(writer != null); Debug.Assert(entry != null); Debug.Assert(baseUrl != null); Debug.Assert(baseUrl.IsAbsoluteUri); var error = entry.Error; writer.Write("<li>"); var errorType = ErrorDisplay.HumaneExceptionErrorType(error); if (errorType.Length > 0) { var abbreviated = errorType.Length < error.Type.Length; if (abbreviated) { writer.Write("<span title='{0}'>", WebUtility.HtmlEncode(error.Type)); } writer.Write(WebUtility.HtmlEncode(errorType)); if (abbreviated) { writer.Write("</span>"); } writer.Write(": "); } writer.Write("<a href='{0}'>", WebUtility.HtmlEncode(baseUrl + "detail?id=" + Uri.EscapeDataString(entry.Id))); writer.Write(WebUtility.HtmlEncode(error.Message)); writer.Write("</a>"); writer.Write("</li>"); }
private ErrorLogEntry MapErrorLogEntry(Message message) { var error = new Error { ApplicationName = message.Application, Detail = message.Detail, HostName = message.Hostname, Message = message.Title, Source = message.Source, StatusCode = message.StatusCode.HasValue ? message.StatusCode.Value : 0, Time = message.DateTime, Type = message.Type, User = message.User, }; foreach (var cookie in (message.Cookies ?? new List <Item>())) { error.Cookies.Add(cookie.Key, cookie.Value); } foreach (var formElement in (message.Form ?? new List <Item>())) { error.Form.Add(formElement.Key, formElement.Value); } foreach (var queryStringItem in (message.QueryString ?? new List <Item>())) { error.QueryString.Add(queryStringItem.Key, queryStringItem.Value); } foreach (var serverVariable in (message.ServerVariables ?? new List <Item>())) { error.ServerVariables.Add(serverVariable.Key, serverVariable.Value); } var errorLogEntry = new ErrorLogEntry(this, message.Id, error); return(errorLogEntry); }
public override ErrorLogEntry GetError(string id) { var errorId = Guid.Parse(id); var error = _logging.GetError(errorId); if (error == null) { throw new RegoException(string.Format("Error with id {0} not found", id)); } var elmahError = new Error { Message = error.Message, Source = error.Source, Detail = error.Detail, User = error.User, HostName = error.HostName, Type = error.Type, Time = error.Time }; var entry = new ErrorLogEntry(this, id, elmahError); return(entry); }
public ErrorLogEntry Create(DateTime timeStamp, string message, string stackTrace, string data, ErrorSeverity severity) { var errorID = 0; _sqlObjectFactory.GetConnection().Using(connection => errorID = Convert.ToInt32(connection.Command("INSERT INTO pf_ErrorLog (TimeStamp, Message, StackTrace, Data, Severity) VALUES (@TimeStamp, @Message, @StackTrace, @Data, @Severity)") .AddParameter("@TimeStamp", timeStamp) .AddParameter("@Message", message) .AddParameter("@StackTrace", stackTrace) .AddParameter("@Data", data) .AddParameter("@Severity", severity) .ExecuteAndReturnIdentity())); var errorLog = new ErrorLogEntry { ErrorID = errorID, TimeStamp = timeStamp, Message = message, StackTrace = stackTrace, Data = data, Severity = severity }; return(errorLog); }
protected override void LogException(Exception e, HttpContext context) { if (e == null) { throw new ArgumentNullException("e"); } ExceptionFilterEventArgs args = new ExceptionFilterEventArgs(e, (object)context); this.OnFiltering(args); if (args.Dismissed) { return; } ErrorLogEntry entry = (ErrorLogEntry)null; try { //FIX STARTS //Error error = new Error(e, context); Error error = CreateErrorSafe(e, context); //FIX ENDS ErrorLog errorLog = this.GetErrorLog(context); error.ApplicationName = errorLog.ApplicationName; string id = errorLog.Log(error); entry = new ErrorLogEntry(errorLog, id, error); } catch (Exception ex) { Trace.WriteLine((object)ex); } if (entry == null) { return; } this.OnLogged(new ErrorLoggedEventArgs(entry)); }
public override ErrorLogEntry GetError(string id) { ErrorLogEntry entry; try { id = new Guid(id).ToString(); } catch (FormatException exception) { throw new ArgumentException(exception.Message, id, exception); } var blobContainer = GetBlobContainer(); var blobs = blobContainer.ListBlobs(); var blobItem = blobs.FirstOrDefault(b => b.Uri.ToString().EndsWith(id + ".xml")); if (blobItem == null) { throw new FileNotFoundException(string.Format("Cannot locate error file for error with ID {0}.", id)); } using (var stream = new MemoryStream()) { var blob = blobContainer.GetBlobReference(blobItem.Uri.ToString()); blob.DownloadToStream(stream); stream.Position = 0; using (var reader = new XmlTextReader(stream)) { Error error = ErrorXml.Decode(reader); entry = new ErrorLogEntry(this, id, error); } } return(entry); }
private ErrorLogEntry MapErrorLogEntry(Message message) { var error = new Error { ApplicationName = message.Application, Detail = message.Detail, HostName = message.Hostname, Message = message.Title, Source = message.Source, StatusCode = message.StatusCode ?? 0, Time = message.DateTime.Value, Type = message.Type, User = message.User, }; (message.Cookies ?? new List <Item>()).ToList().ForEach(c => error.Cookies.Add(c.Key, c.Value)); (message.Form ?? new List <Item>()).ToList().ForEach(c => error.Form.Add(c.Key, c.Value)); (message.QueryString ?? new List <Item>()).ToList().ForEach(c => error.QueryString.Add(c.Key, c.Value)); (message.ServerVariables ?? new List <Item>()).ToList().ForEach(c => error.ServerVariables.Add(c.Key, c.Value)); var errorLogEntry = new ErrorLogEntry(this, message.Id, error); return(errorLogEntry); }
public override string Log(Error error) { if (error == null) { throw new ArgumentNullException("error"); } error = (Error)((ICloneable)error).Clone(); ErrorHelper.Obscure(error, this._obfuscationConfiguration); error.ApplicationName = base.ApplicationName; Guid guid = Guid.NewGuid(); ErrorLogEntry entry = new ErrorLogEntry(this, guid.ToString(), error); MaskedMemoryErrorLog._lock.AcquireWriterLock(-1); try { if (MaskedMemoryErrorLog._entries == null) { MaskedMemoryErrorLog._entries = new MaskedMemoryErrorLog.EntryCollection(this._size); } MaskedMemoryErrorLog._entries.Add(entry); } finally { MaskedMemoryErrorLog._lock.ReleaseWriterLock(); } return guid.ToString(); }
public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList) { if (pageIndex < 0) { throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null); } if (pageSize < 0) { throw new ArgumentOutOfRangeException("pageSize", pageSize, null); } ErrorLogEntry[] array = null; MaskedMemoryErrorLog._lock.AcquireReaderLock(-1); int count; try { if (MaskedMemoryErrorLog._entries == null) { return 0; } count = MaskedMemoryErrorLog._entries.Count; int num = pageIndex * pageSize; int num2 = Math.Min(num + pageSize, count); int num3 = Math.Max(0, num2 - num); if (num3 > 0) { array = new ErrorLogEntry[num3]; int i = num2; int num4 = 0; while (i > num) { array[num4++] = MaskedMemoryErrorLog._entries[--i]; } } } finally { MaskedMemoryErrorLog._lock.ReleaseReaderLock(); } if (errorEntryList != null && array != null) { ErrorLogEntry[] array2 = array; for (int j = 0; j < array2.Length; j++) { ErrorLogEntry errorLogEntry = array2[j]; Error error = (Error)((ICloneable)errorLogEntry.Error).Clone(); errorEntryList.Add(new ErrorLogEntry(this, errorLogEntry.Id, error)); } } return count; }
public override ErrorLogEntry GetError(string id) { ErrorDocument document; using (var session = _documentStore.OpenSession(ApplicationName)) { document = session.Load<ErrorDocument>(id); } var result = new ErrorLogEntry(this, id, document.Error); return result; }