/// <summary> /// Método que inserta el log en el appender especificado a partir de una /// excepción controlada /// </summary> /// <returns></returns> /// <CreatedBy>Gabriel Herrera Z</CreatedBy> public static void SetLog(ExceptionOperation ex) { if (ex != null) { _log.Error(ex.Message + "|" + ex.InnerException + "|" + ex.StackTrace); } }
public static void SetLogError(object message, ExceptionOperation exception) { string loggerName = exception.Operation; _log.Error(message, exception); _log.Error(exception.StackTrace); }
private string GetDefaultMessageForException(Exception exception) { var message = $"{_localizationService.GetValue(exception.Message)}"; if (exception.InnerException != null) { message += $"-- {_localizationService.GetValue(exception.InnerException.Message)}"; } if (message.Contains("See the inner exception for details")) { if (exception.InnerException != null) { message = exception.InnerException.Message; } } if (message.Contains("See the inner exception for details")) { if (exception.InnerException?.InnerException != null) { message = exception.InnerException.InnerException.Message; } } if (message.Contains("See the inner exception for details")) { if (exception.InnerException?.InnerException?.InnerException != null) { message = exception.InnerException.InnerException.InnerException.Message; } } var returnMessage = new ExceptionOperation(exception).GetReturnMessage(ref message); var localizatedReturnMessage = _localizationService.GetValue(returnMessage); return(localizatedReturnMessage == string.Empty ? $"{_localizationService.GetValue(message)}" : $"{localizatedReturnMessage}"); }