コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: LogErrorsAttribute.cs プロジェクト: tmassey/playing
 public override void OnActionExecuted(ActionExecutedContext context)
 {
     if (context.Exception != null)
     {
         LoggingBootstrapper.GetLogger().Fatal(context.Exception, GetUserDetails((PhoenixBaseController)context.Controller));
     }
     base.OnActionExecuted(context);
 }
コード例 #3
0
        public static void BootstrapForSystem(
            string logName,
            ITinyReturnsDatabaseSettings tinyReturnsDatabaseSettings)
        {
            LoggingBootstrapper.StartupLog(logName);

            var logForNetSystemLog = new LogForNetSystemLog();

            BootstrapAll(logForNetSystemLog, tinyReturnsDatabaseSettings);
        }
コード例 #4
0
ファイル: Startup.cs プロジェクト: tmassey/playing
        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(); });
        }
コード例 #5
0
        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}");
        }
コード例 #6
0
 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);
 }
コード例 #7
0
ファイル: Startup.cs プロジェクト: tmassey/playing
 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);
 }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 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));
 }