public void Start() { Database.Initialize(ConnectionString); DapperConfig.Initialize(); DefaultTraceLogInitializer.Initialize(ConnectionString, TraceLogLevel.Trace); MarkdownParser.RegisterJsEngineType <V8JsEngine>(); _logger.Trace(string.Format("WEBJOB Start: Interval = {0} ミリ秒", Interval.ToString("##,###"))); var service = new SearchService(ConnectionString); var status = service.GetServiceStatusAsync().Result; if (status == ServiceStatus.IndexNotExists) { service.RecreateEsIndexAsync().Wait(); } _timer = new Timer { Interval = Interval }; _timer.Elapsed += Execute; _timer.Start(); }
public void ExecuteFinish(IDbCommand profiledDbCommand, SqlExecuteType executeType, System.Data.Common.DbDataReader reader) { _commandText = profiledDbCommand.CommandText; if (executeType == SqlExecuteType.Reader) return; _stopwatch.Stop(); _logger.Trace(new TraceLogMessage(executeType, _commandText, _stopwatch.ElapsedMilliseconds)); }
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { var controller = actionExecutedContext.ActionContext.ActionDescriptor.ControllerDescriptor.ControllerName; var action = actionExecutedContext.ActionContext.ActionDescriptor.ActionName; var area = string.Empty; var method = actionExecutedContext.Request.Method; var key = new { area, controller, action, method }; _traceLogger.Trace(new TraceLogMessage(0, JsonConvert.SerializeObject(key), _stopwatch.ElapsedMilliseconds)); base.OnActionExecuted(actionExecutedContext); }
public override void OnResultExecuted(ResultExecutedContext filterContext) { var controller = filterContext.RouteData.Values["controller"].ToString(); var action = filterContext.RouteData.Values["action"].ToString(); var area = string.Empty; if (filterContext.RouteData.DataTokens.ContainsKey("area")) { area = filterContext.RouteData.DataTokens["area"].ToString(); } var method = filterContext.HttpContext.Request.HttpMethod; var key = new { area, controller, action, method }; _traceLogger.Trace(new TraceLogMessage(0, JsonConvert.SerializeObject(key), _stopwatch.ElapsedMilliseconds)); base.OnResultExecuted(filterContext); }