public bool Resent(string id, LogApi log) { if (log.Entity.Equals("EmpresaExact") || log.Entity.Equals("Company")) { return(ResendEmpresaExact(id, log)); } if (log.Entity.Equals("ContatoExact") || log.Entity.Equals("Contact")) { return(ResendContatoExact(id, log)); } if (log.Entity.Equals("EventoExact") || log.Entity.Equals("Event")) { return(ResendEventoExact(id, log)); } if (log.Entity.Equals("LeadExact") || log.Entity.Equals("Lead")) { return(ResendLeadExact(id, log)); } if (log.Entity.Equals("ReuniaoExact") || log.Entity.Equals("Schedule")) { return(ResendReuniaoExact(id, log)); } return(false); }
List <string> hcSessions = new List <string>(); //健康检查导致的seesion。这种session在人数统计时要忽略。 protected void Session_Start(Object sender, EventArgs e) //客户端一连接到服务器上,这个事件就会发生 { var bHC = System.Web.HttpContext.Current.Request["bHC"]; if (bHC == "1") { hcSessions.Add(Session.SessionID); return; } // ComClass.GetWXWebRootName(); Application.Lock();//锁定后,只有这个Session能够会话 try { LogApi.IncreaseOnlineVisitNum(); } catch (Exception ex) { throw ex; } finally { Application.UnLock();//会话完毕后解锁 } //Session["SessionId"] = Session.SessionID; }
public async Task <IHttpActionResult> Posttbl_Jobs(tbl_Jobs tbl_Jobs) { LogApi.Log(User.Identity.GetUserId(), "PostJob " + User.Identity.GetUserName()); var id = User.Identity.GetUserId(); tbl_Jobs.col_PostedBy = id; tbl_Jobs.col_Expired = false; tbl_Jobs.col_PostDateTime = DateTime.Now; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_Jobs.Add(tbl_Jobs); await db.SaveChangesAsync(); try { var tokens = db.tbl_DeviceIds; foreach (var d in tokens) { Notifications.NotifyAsync(d.col_DeviceToken, "Job", "New job: " + tbl_Jobs.col_JobTitle + "#" + tbl_Jobs.col_JobDescription); } } catch (Exception ex) { } return(Ok("Posted")); }
private bool ResendReuniaoExact(string id, LogApi log) { var _value = JsonConvert.DeserializeObject <ReuniaoExact>(log.Send); if (log.Method.Equals("Post")) { var resp = Execute(log, _value, (c, v) => c.ScheduleRegister(_value)); return(resp); } if (log.Method.Equals("Put")) { _value.Reuniao.Id = log.Parameters; var resp = Execute(log, _value, (c, v) => c.ScheduleUpdate(_value)); return(resp); } if (log.Method.Equals("Delete")) { var aut = JsonConvert.DeserializeObject <Autenticacao>(log.Send); var resp = Execute(log, _value, (c, v) => c.ScheduleDelete(log.Parameters, aut)); return(resp); } return(false); }
public async Task <ActionResult> Index() { var userID = AbpSession.UserId ?? -1; var userIDStr = userID == -1 ? "" : userID.ToString(); var userName = ""; try { var user = await _userAppService.Get(new EntityDto <long>() { Id = userID }); if (user != null) { userName = user.UserName; } } catch (Exception ex) { } Log_OperateTraceBllEdm log = new Log_OperateTraceBllEdm() { UserID = userIDStr, UserName = userName, LogType = LogType.业务记录, TabOrModu = "系统监控", Detail = "进入了页面" }; string msg = LogApi.WriteLog(LogLevel.Info, log); return(View()); }
//从配置文件中读取cache服务器地址 static Dictionary <string, int> GetServerPort(bool bRedis) { Dictionary <string, int> serverList = new Dictionary <string, int>(); var serverStr = ""; if (!bRedis) { serverStr = AppConfig.GetFinalConfig("MemCacheServer", "", LogApi.GetMemCacheServer()); } else { serverStr = AppConfig.GetFinalConfig("RedisCacheServer", "", LogApi.GetRedisCacheServer()); } if (string.IsNullOrEmpty(serverStr)) { return(serverList); } var oneServer = serverStr.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in oneServer) { var ipPort = item.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); try { serverList.Add(ipPort[0], Convert.ToInt32(ipPort[1])); } catch { } } return(serverList); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime appLifetime) { app = LogApi.AddLog2netConfigure(app, env); // LogORM.LogORMDNC.AddLog2netConfigure(app, env); if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); appLifetime.ApplicationStarted.Register(() => StartFunction()); appLifetime.ApplicationStopped.Register(() => StopFunction()); }
public async Task <IHttpActionResult> Posttbl_News(tbl_News tbl_News) { LogApi.Log(User.Identity.GetUserId(), "PostNews " + User.Identity.GetUserName()); tbl_News.col_NewsDateTime = DateTime.Now; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_News.Add(tbl_News); await db.SaveChangesAsync(); try { var tokens = db.tbl_DeviceIds; foreach (var d in tokens) { Notifications.NotifyAsync(d.col_DeviceToken, "News", "News: " + tbl_News.col_News); } } catch (Exception ex) { } return(Ok("Posted")); }
public async Task <ActionResult> Index() { ViewBag.LogTypeExceptNum = (int)Log2Net.Models.LogType.异常; var userID = AbpSession.UserId ?? -1; var userIDStr = userID == -1 ? "" : userID.ToString(); var userName = ""; try { var user = await _userAppService.Get(new EntityDto <long>() { Id = userID }); if (user != null) { userName = user.UserName; } } catch (Exception ex) { } LgWG.LogQuery.Web.Models.IndexView iv = new Models.IndexView(); iv.Apps = getApply(DateTime.Now.AddDays(-7).ToString(), DateTime.Now.ToString()); Log_OperateTraceBllEdm log = new Log_OperateTraceBllEdm() { UserID = userIDStr, UserName = userName, LogType = LogType.业务记录, TabOrModu = "操作日志", Detail = "进入了页面" }; string msg = LogApi.WriteLog(LogLevel.Info, log); return(View(iv)); }
public async Task <IHttpActionResult> Posttbl_Requirements(tbl_Requirements tbl_Requirements) { LogApi.Log(User.Identity.GetUserId(), "PostRequirement " + User.Identity.GetUserName()); var id = User.Identity.GetUserId(); tbl_Requirements.col_PostedBy = id; tbl_Requirements.col_RequirementPostedDate = DateTime.Now; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_Requirements.Add(tbl_Requirements); await db.SaveChangesAsync(); try { var tokens = db.tbl_DeviceIds; foreach (var d in tokens) { Notifications.NotifyAsync(d.col_DeviceToken, "Requirement", "New Requirement: " + tbl_Requirements.col_RequirementCategory + "#" + tbl_Requirements.col_RequirementDescription + "#" + id); } } catch (Exception ex) { return(Ok("Failed")); } return(Ok("Posted")); }
public async Task <IHttpActionResult> Posttbl_BusinessDirectory(tbl_BusinessDirectory tbl_BusinessDirectory) { LogApi.Log(User.Identity.GetUserId(), "PutBusiness " + User.Identity.GetUserName()); var id = User.Identity.GetUserId(); tbl_BusinessDirectory.col_PostedBy = id; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_BusinessDirectory.Add(tbl_BusinessDirectory); await db.SaveChangesAsync(); try { var tokens = db.tbl_DeviceIds; foreach (var d in tokens) { Notifications.NotifyAsync(d.col_DeviceToken, "Business", "New business: " + tbl_BusinessDirectory.col_BusinessCategory + " " + tbl_BusinessDirectory.col_BusinessDescription); } } catch (Exception ex) { } return(Ok("Posted")); }
public void Start() { LogApi.Log("Start MySQL Service."); _watcherCTS?.Cancel(); _watcherCTS = new CancellationTokenSource(); Task.Factory.StartNew(WatcherLoop, _watcherCTS.Token); }
public async Task <bool> StartMySQL(string instancePath, string iniPath) { var p = new Process(); var info = p.StartInfo; info.FileName = instancePath; info.Arguments += $" --defaults-file=\"{iniPath}\" --console"; info.UseShellExecute = false; info.CreateNoWindow = true; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; info.RedirectStandardError = true; p.OutputDataReceived += MySQLProcess_OutputDataReceived; p.ErrorDataReceived += MySQLProcess_ErrorDataReceived; LogApi.Log($"Starting MySQL:{instancePath} {info.Arguments}"); p.Start(); p.BeginOutputReadLine(); var success = await ProcessUtil.WaitUntilProcessExist(DefaultMySQLProcessName); if (!success) { return(false); } await Task.Delay(500); var pids = await ProcessUtil.GetSubprocessList(p.Id); if (pids.Count < 2) { return(false); } return(true); }
public IQueryable <tbl_News> Gettbl_News() { LogApi.Log(User.Identity.GetUserId(), "GetNews " + User.Identity.GetUserName()); var dt = DateTime.Now.Date; return(db.tbl_News.Where(n => n.col_NewsDateTime.Day == dt.Day && n.col_NewsDateTime.Month == dt.Month && n.col_NewsDateTime.Year == dt.Year)); }
public async Task <IHttpActionResult> GetAlert() { LogApi.Log(User.Identity.GetUserId(), "Alerts from " + User.Identity.GetUserName()); String alert = db.tbl_Alerts.FirstOrDefault().col_Alert.ToString(); return(Ok(alert)); }
public IActionResult About() { ViewData["Message"] = "Your application description page."; var dic = LogApi.GetLogWebApplicationsName(); var userCnt = LogApi.GetNumOfOnLineAllVisit(); return(View()); }
private void RaiseOnNewInstanceFound(MySQLInstance instance) { var dataDir = AnalyzeMySQLDataDirFromIni(instance.InstanceIniPath); instance.DataDir = dataDir; LogApi.Log($"{instance} Found."); NewInstaceFound?.Invoke(this, instance); }
private void UpdateScTimer_Tick(object sender, EventArgs e) { if (!MSCM_UpdateServiceStatus(updateScItem.Text, NativeBridge.scMgrEnumServicesCallBackPtr)) { LogApi.LogErr2("UpdateServiceStatus for service " + updateScItem.Text + " failed."); } updateScTimer.Stop(); }
protected void Application_End(object sender, EventArgs e) { try { LogApi.WriteServerStopLog();//写停止日志 } catch { } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //第一步:注册日志系统 LogApi.RegisterLogInitMsg(SysCategory.SysB_01, Application, GetUserConfigItemByCode(), GetLogWebApplicationsNameByCode());//日志系统注册 }
protected void Application_Error(object sender, EventArgs e) { try { LogApi.HandAndWriteException(); } catch { System.Web.HttpContext.Current.Server.ClearError(); } }
public void Debug() { //Arrange ILogApi logApi = new LogApi(); //Act var response = logApi.Debug(Guid.NewGuid().ToString()); //Assert Assert.NotNull(response); }
private void UpdateLoggerApi(LogApi log, bool addLog, bool success) { if (!addLog) { return; } log.Response = _service.MessageController().GetAllMessage().ToJson(); log.Type = success ? "Success" : "Error"; _loggerApiService.Update(log); }
public IEnumerable <AspNetUser> GetBirthdayMembers() { LogApi.Log(User.Identity.GetUserId(), "GetBirthdayMembers " + User.Identity.GetUserName()); IEnumerable <AspNetUser> source = null; // Return List of Customer source = (from users in db.AspNetUsers select users).Where(u => u.DateOfBirth.Day == DateTime.Now.Day && u.DateOfBirth.Month == DateTime.Now.Month).AsQueryable(); return(source); }
protected void Session_End(object sender, EventArgs e) { if (hcSessions.Contains(Session.SessionID)) { hcSessions.Remove(Session.SessionID); return; } Application.Lock(); LogApi.ReduceOnlineNum(); Application.UnLock(); GlobalSessionEnd(); }
static InfluxDBHelper() { if (AppConfig.GetFinalConfig("bWriteToInfluxDB", false, LogApi.IsWriteToInfluxDB())) { var serverStr = AppConfig.GetFinalConfig("InfluxDBServer_Log", "http://127.0.0.1:8086/;logAdmin;sa123.123", LogApi.GetInfluxDBServer_Log()); //http://127.0.0.1:8086/;logAdmin;sa123.123 var temp = serverStr.Split(';'); influxDbClient = new InfluxDbClient(temp[0], temp[1], temp[2], InfluxDbVersion.Latest); } else { influxDbClient = null; } }
//获取数据库连接字符串 public static string GetConnectionString(DBType dbType) { if (AppConfig.GetFinalConfig("ConnectStrIsInCode", false, LogApi.IsConnectStrInCode())) { return(dbType == DBType.LogTrace ? LogApi.GetTraceDBConnectionString() : LogApi.GetMonitorDBConnectionString()); } else { string sqlStrKey = GetConnectionStringKey(dbType); string conStr = AppConfig.GetDBConnectString(sqlStrKey); return(conStr); } }
//static Buffer2DBAppender() //{ // StartMQTask(); //} //开启线程消费队列中的内容 void StartMQTask() { //开启线程消费队列中的内容 ThreadPool.QueueUserWorkItem(StartWriteTraceDataService, null); //启动写trace日志数据服务 ThreadPool.QueueUserWorkItem(StartWriteMonitorDataService, null); //启动写monitor日志数据服务 LogTraceEdm logModel = new LogTraceEdm() { Detail = "日志记录的" + BufferType + "消费服务启动" }; LogApi.WriteMsgToDebugFile(new { msg = logModel.Detail }); // LogApi.WriteLog(LogLevel.Info, logModel); }
public IActionResult Contact() { ViewData["Message"] = "Your contact page."; LogTraceVM logModel = new LogTraceVM() { LogType = LogType.审批, Detail = "人间天堂,最美苏杭", TabOrModu = "联系我们" }; new ComClass().WriteLog(LogLevel.Info, logModel); var logRes = LogApi.WriteLoginLog("CN888"); return(View()); }
public async Task <IHttpActionResult> GetAspNetUser(string id) { LogApi.Log(User.Identity.GetUserId(), "GetUser from " + User.Identity.GetUserName()); AspNetUser aspNetUser = await db.AspNetUsers.FindAsync(id); if (aspNetUser == null) { return(NotFound()); } return(Ok(aspNetUser)); }