public static void ConfigureAgentTarget(AScriptRunnerAgent agent, int levelLimit, string targetName = AgentTargetName) { var agentTarget = new RelativityAgentNLogTarget(agent, levelLimit); var configuration = LoggingBootstrapper.EnsureConfiguration(); configuration.AddTarget(AgentTargetName, agentTarget); LogLevel logLevel; if (levelLimit >= 10) { logLevel = LogLevel.Info; } else if (levelLimit >= 5) { logLevel = LogLevel.Warn; } else if (levelLimit >= 1) { logLevel = LogLevel.Error; } else { logLevel = LogLevel.Off; } configuration.AddRule(logLevel, LogLevel.Fatal, targetName); LogManager.ReconfigExistingLoggers(); }
public override void OnActionExecuted(ActionExecutedContext context) { if (context.Exception != null) { LoggingBootstrapper.GetLogger().Fatal(context.Exception, GetUserDetails((PhoenixBaseController)context.Controller)); } base.OnActionExecuted(context); }
public static void BootstrapForSystem( string logName, ITinyReturnsDatabaseSettings tinyReturnsDatabaseSettings) { LoggingBootstrapper.StartupLog(logName); var logForNetSystemLog = new LogForNetSystemLog(); BootstrapAll(logForNetSystemLog, tinyReturnsDatabaseSettings); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { LoggingBootstrapper.Configure(app); app.UseRouting(); AuthenticationBootstrapper.Configure(app); DocumentationBootstrapper.Configure(app); RegistryServiceBootstrapper.Configure(app); ConfigureForBootstrappers(app); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
private void SetupLogging() { Target.Register <RelativityAgentNLogTarget>("RelativityAgentTarget"); // Initialize agent logging AgentLoggingBootstrapper.ConfigureAgentTarget(this, 10); // Initialize event log logging. LoggingBootstrapper.ConfigureEventLogTarget("ScriptRunner Agent"); NLog.MappedDiagnosticsContext.Set("Agent", $"{this.Name}:{this.AgentID}"); }
public static void Register(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver, DataAccessConfiguration dataAccessConfig) { EnvironmentServicesBootstrapper.RegisterEnvironmentServices(services, resolver); ConfigurationBootstrapper.RegisterConfiguration(services, resolver, dataAccessConfig); LoggingBootstrapper.RegisterLogging(services, resolver); AvaloniaServicesBootstrapper.RegisterAvaloniaServices(services); FileSystemWatcherServicesBootstrapper.RegisterFileSystemWatcherServices(services, resolver); DataAccessBootstrapper.RegisterDataAccess(services, resolver); ServicesBootstrapper.RegisterServices(services, resolver); ViewModelsBootstrapper.RegisterViewModels(services, resolver); }
public void ConfigureServices(IServiceCollection services) { RabbitBootstrapper.ConfigureServices(services); LoggingBootstrapper.ConfigureServices(services); DocumentationBootstrapper.ConfigureServices(services); services.AddWebEncoders(); services.AddDataProtection(); AuthenticationBootstrapper.ConfigureServices(services); RegistryServiceBootstrapper.ConfigureServices(services); services.AddMvcCore(opt => opt.EnableEndpointRouting = false); services.AddControllers() .AddNewtonsoftJson(GetSerializerSettings); ConfigureServicesForBootstrappers(services); }
public static void BootstrapForSystem( string logName, IOfficeLocationDatabaseSettings officeLocationDatabaseSettings, ICountryWebApiSettings countryWebApiSettings, IEmailSettings emailSettings, IGroupNameConstants groupNameConstants) { LoggingBootstrapper.StartupLog(logName); var logForNetSystemLog = new LogForNetSystemLog(); BootstrapAll(logForNetSystemLog, officeLocationDatabaseSettings, countryWebApiSettings, emailSettings, groupNameConstants); }
public override void OnActionExecuting(ActionExecutingContext context) { var apiKey = context.HttpContext.Request.Query["ApiKey"]; var jwtToken = context.HttpContext.Request.Query.ContainsKey("ApiKey") ? GetTokenFromApiKeyAsync(context.HttpContext.Request.Query["ApiKey"]) : GetAuthJwtToken(context) ; try { var key = SigningCertificate.Load().GetRSAPrivateKey(); var payload = JWT.Decode <JwtToken>(jwtToken.Replace("Bearer ", ""), key, JwsAlgorithm.RS256); var tokenExpires = DateTimeOffset.FromUnixTimeSeconds(payload.exp); _user = tokenExpires > DateTime.UtcNow ? _userManager.SetUser(payload, jwtToken) : null; } catch (Exception e) { LoggingBootstrapper.GetLogger().Fatal(e); _user = null; } base.OnActionExecuting(context); }
private static void LogNetworkCall(ResultExecutedContext context, int duration = 0) { LoggingBootstrapper.GetLogger().Network(context.HttpContext.Request.Method, (HttpStatusCode)context.HttpContext.Response.StatusCode, context.HttpContext.Request.Path, duration, Service.Config.ServiceConfiguration?.ServiceId, GetUserDetails((PhoenixBaseController)context.Controller)); }