public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder(); builder.SetBasePath(env.ContentRootPath); builder.AddJsonFile("appsettings.json"); builder.AddJsonFile($"appsettings.{Environment.UserName}.json", optional: true); _config = builder.Build(); var connectionStrings = _config.GetConfigSection <ConnectionStrings>(); _logger = new SeriLogger( new ApplicationLoggerSettings { ApplicationLoggerOutputSettingsCollection = new List <IApplicationLoggerOutputSettings> { new MsSqlServerApplicationLoggerOutputSettings { MinimumLogLevel = LogLevel.Verbose, ConnectionString = connectionStrings.AppLogs, LogsTableName = "Logs" } } }, new ExecutionContext()); CultureInfo.CurrentCulture = new CultureInfo("en-GB"); }
public void SetupSeriLogConfig() { var logger = new SeriLogger(new Mock <ApplicationLoggerSettings>().Object); var l = logger.ConfigureSerilog(); Assert.NotNull(l); }
public void CreateSqlServerLoggerTest() { var logger = new SeriLogger(new Mock <ApplicationLoggerSettings>().Object); var config = logger.ConfigureSerilog(); var result = ConsoleLoggerFactory.CreateLogger(config); Assert.NotNull(result); }
public static void Main(string[] args) { var configBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(ConfigFile); IConfiguration configuration = configBuilder.Build(); IJobStatusWebServiceCallServiceConfig auditingPersistenceServiceConfig = new JobStatusWebServiceCallServiceConfig(configuration["jobSchedulerApiEndPoint"]); IQueueConfiguration queueConfiguration = new JobStatusQueueConfiguration(configuration["queueConnectionString"], configuration["queueName"], 1); ISerializationService serializationService = new JsonSerializationService(); IApplicationLoggerSettings applicationLoggerOutputSettings = new ApplicationLoggerSettings { ApplicationLoggerOutputSettingsCollection = new List <IApplicationLoggerOutputSettings> { new MsSqlServerApplicationLoggerOutputSettings { ConnectionString = configuration["logConnectionString"], MinimumLogLevel = LogLevel.Information }, new ConsoleApplicationLoggerOutputSettings { MinimumLogLevel = LogLevel.Information } }, TaskKey = "Job Fail Status", EnableInternalLogs = true, JobId = "Job Fail Status Service", MinimumLogLevel = LogLevel.Information }; IExecutionContext executionContext = new ExecutionContext { JobId = "Job Fail Status Service", TaskKey = "Job Fail Status" }; ILogger logger = new SeriLogger(applicationLoggerOutputSettings, executionContext); IDateTimeProvider dateTimeProvider = new DateTimeProvider.DateTimeProvider(); IQueueSubscriptionService <JobContextDto> queueSubscriptionService = new QueueSubscriptionService <JobContextDto>(queueConfiguration, serializationService, logger); IJobStatusWebServiceCallService <JobContextDto> failedJobsWebServiceCallService = new FailedJobsWebServiceCallService(auditingPersistenceServiceConfig, queueSubscriptionService, serializationService, logger); failedJobsWebServiceCallService.Subscribe(); logger.LogInfo($"Started {executionContext.JobId}!"); ManualResetEvent oSignalEvent = new ManualResetEvent(false); oSignalEvent.WaitOne(); }
public static void Main(string[] args) { var configBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(ConfigFile); IConfiguration configuration = configBuilder.Build(); IAuditingPersistenceServiceConfig auditingPersistenceServiceConfig = new AudtingPersistenceServiceConfig(configuration["auditConnectionString"]); IQueueConfiguration queueConfiguration = new AuditQueueConfiguration(configuration["queueConnectionString"], configuration["queueName"], 1); ISerializationService serializationService = new JsonSerializationService(); IApplicationLoggerSettings applicationLoggerOutputSettings = new ApplicationLoggerSettings { ApplicationLoggerOutputSettingsCollection = new List <IApplicationLoggerOutputSettings> { new MsSqlServerApplicationLoggerOutputSettings { ConnectionString = configuration["logConnectionString"], MinimumLogLevel = LogLevel.Information }, new ConsoleApplicationLoggerOutputSettings { MinimumLogLevel = LogLevel.Information } }, TaskKey = "Audit", EnableInternalLogs = true, JobId = "Audit Service", MinimumLogLevel = LogLevel.Information }; IExecutionContext executionContext = new ExecutionContext { JobId = "Audit Service", TaskKey = "Audit" }; ILogger logger = new SeriLogger(applicationLoggerOutputSettings, executionContext); IQueueSubscriptionService <AuditingDto> queueSubscriptionService = new QueueSubscriptionService <AuditingDto>(queueConfiguration, serializationService, logger); IAuditingPersistenceService <AuditingDto> auditingPersistenceService = new AuditingPersistenceService <AuditingDto>(auditingPersistenceServiceConfig, queueSubscriptionService, logger); auditingPersistenceService.Subscribe(); logger.LogInfo("Started!"); ManualResetEvent oSignalEvent = new ManualResetEvent(false); oSignalEvent.WaitOne(); }
static void Main(string[] args) { //Configuration = new ConfigurationBuilder().Build(); //var serviceProvider = new ServiceCollection() // .AddSingleton<IConfiguration>(Configuration) // .AddTransient(typeof(ICacheProvider), typeof(CacheManagerProvider)) // .AddSingleton<CacheInterceptor>() // .AddMvcCore(x => x.Filters.Add(typeof(CacheInterceptor))); #region Job var jobsetting = new JobSetting { JobName = "somename", TriggerName = "sometrigger", IntervalInMinutes = 1 }; var logger = new SeriLogger(new Logger <SeriLogger>(new LoggerFactory())); var host = HostFactory.Run(x => { x.Service <QuartzScheduler <TestJob> >(s => { s.WhenStarted(service => service.Start(jobsetting)); s.WhenStopped(service => service.Stop()); s.ConstructUsing(() => new QuartzScheduler <TestJob>(logger)); }); x.RunAsLocalSystem() .DependsOnEventLog() .StartAutomatically() .EnableServiceRecovery(rc => rc.RestartService(1)); x.SetDisplayName(jobsetting.JobName); x.SetServiceName(jobsetting.JobName); x.SetDescription(jobsetting.JobName); }); #endregion }
public void TestFixtureSetUp() { _encompassConfig = new IntegrationEncompassConfig(); SeriLogger.Setup(_encompassConfig); }
public void TestFixtureSetUp() { _encompassConfig = new IntegrationEncompassConfig(); Console.WriteLine("Rawr"); var _ = SeriLogger.Setup(_encompassConfig); }