public static bool GravarErro(Exception ex) { try { string strSisID = CFG_ConfiguracaoBO.SelecionaValorPorChave("appSistemaID"); int sis_id; if (!Int32.TryParse(strSisID, out sis_id)) { sis_id = 1; } LOG_Erros entity = new LOG_Erros(); entity.sis_id = sis_id; entity.err_descricao = GetErrorMessage(ex); entity.err_erroBase = ex.GetBaseException().Message; entity.err_tipoErro = ex.GetBaseException().GetType().FullName; entity.err_dataHora = DateTime.Now; entity.err_machineName = Environment.MachineName; string strHostName; string clientIPAddress = ""; try { strHostName = System.Net.Dns.GetHostName(); clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString(); } catch { } entity.err_ip = String.IsNullOrEmpty(clientIPAddress) ? "0.0.0.0" : clientIPAddress; LOG_ErrosBO.Save(entity); } catch { } return(false); }