public static void SaveLogToDB(ProcessInfo pi) { Context p_ctx = Env.GetContext(); //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); System.Threading.Thread.CurrentThread.CurrentCulture = Env.GetLanguage(p_ctx).GetCulture(Env.GetBaseAD_Language()); System.Threading.Thread.CurrentThread.CurrentUICulture = Env.GetLanguage(p_ctx).GetCulture(Env.GetBaseAD_Language()); ProcessInfoLog[] logs = pi.GetLogs(); if (logs == null || logs.Length == 0) { _log.Fine("No Log"); return; } if (pi.GetAD_PInstance_ID() == 0) { _log.Log(Level.WARNING, "AD_PInstance_ID==0"); return; } for (int i = 0; i < logs.Length; i++) { StringBuilder sql = new StringBuilder("INSERT INTO AD_PInstance_Log " + "(AD_PInstance_ID, Log_ID, P_Date, P_ID, P_Number, P_Msg)" + " VALUES ("); sql.Append(pi.GetAD_PInstance_ID()).Append(",") .Append(logs[i].GetLog_ID()).Append(","); if (logs[i].GetP_Date() == null) { sql.Append("NULL"); } else { sql.Append(GlobalVariable.TO_DATE(logs[i].GetP_Date(), false)); } sql.Append(","); if (logs[i].GetP_ID() == 0) { sql.Append("NULL"); } else { sql.Append(logs[i].GetP_ID()); } sql.Append(","); if (logs[i].GetP_Number() == null) { sql.Append("NULL"); } else { sql.Append(logs[i].GetP_Number()); } sql.Append(","); if (logs[i].GetP_Msg() == null) { sql.Append("NULL)"); } else { sql.Append(GlobalVariable.TO_STRING(logs[i].GetP_Msg(), 2000)).Append(")"); } SqlExec.ExecuteQuery.ExecuteNonQuery(sql.ToString()); } //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE"); //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE"); System.Threading.Thread.CurrentThread.CurrentCulture = Utility.Env.GetLanguage(Utility.Env.GetContext()).GetCulture(Env.GetLoginLanguage(p_ctx).GetAD_Language()); System.Threading.Thread.CurrentThread.CurrentUICulture = Utility.Env.GetLanguage(Utility.Env.GetContext()).GetCulture(Env.GetLoginLanguage(p_ctx).GetAD_Language()); pi.SetLogList(null); // otherwise log entries are twice }