public void LogException(Exception exception) { if (database == 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 = database.GetCurrentTestID(); database.LogError(error); }
public Int64 LogError(ErrorLogEntry error) { var query = error.Query + ";" + scopedIdentityQuery; using (SqlCommand command = new SqlCommand(query, connection)) { foreach (var param in error.Parameters) { command.Parameters.Add(param); } return((Int64)command.ExecuteScalar()); } }
public void LogException(Exception exception) { if (database == 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 = database.GetCurrentTestID(); database.LogError(error); }