示例#1
0
        static void Main(string[] args)
        {
            _config = (new ServiceConfigurationManager()).GetServiceConfiguration();
            var serviceName = "NBNAutoImportService";

            //configure logging
            Log4NetConfiguration.Configure(_config, serviceName);

            HostFactory.Run(x =>
            {
                x.UseLog4Net();
                x.Service <PollingService>(s =>
                {
                    s.ConstructUsing(name => new PollingService());
                    s.WhenStarted(ps => ps.Start());
                    s.WhenStopped(ps => ps.Stop());
                });
                x.RunAsLocalSystem();

                x.SetDescription(
                    "Periodically checks for new NBN import files and runs the importer to ingest them.");
                x.SetDisplayName("NBN Automatic import service");
                x.SetServiceName(serviceName);

                x.BeforeInstall(EnsureConfiguration);
            });
        }
示例#2
0
        static void Main(string[] args)
        {
            Log4NetConfiguration.SetUpLogging(Assembly.GetExecutingAssembly());

            Log.Error("Program Running");

            string baseAddress = "http://*****:*****@ev}"));
                hubConnection.Start().Wait();

                // Join the channel for task updates in our console window
                //
                eventHubProxy.Invoke("Subscribe", Constants.AdminChannel);
                eventHubProxy.Invoke("Subscribe", Constants.TaskChannel);

                Console.WriteLine($"Server is running on {baseAddress}");
                Console.WriteLine("Press <enter> to stop server");
                Console.ReadLine();
            }
        }
 public virtual void SetUp()
 {
     Log4NetConfiguration.InitializeOnce();
     WebDriverCache.RestartIfNeed();
     WebDriverCache.WebDriver.DeleteAllCookies();
     WebDriverCache.WebDriver.CleanDownloadDirectory();
     PageLoadCounter.Reset();
     JsLogger.Reset();
 }
示例#4
0
        public void SaveLogs(Log l, string loggerInstance)
        {
            Log4NetConfiguration config = _settings.Config.Log4NetConfigurations.FirstOrDefault(c => c.LogName == loggerInstance);

            if (config == null)
            {
                throw new ConfigurationErrorsException(string.Format("Log4Net configuration for {0} not found", loggerInstance));
            }

            if (!config.IsEnabled)
            {
                return;
            }

            if (l.Severity < config.VerbosityLevel)
            {
                return;
            }

            ILog tempLogger = LogManager.GetLogger(loggerInstance);

            if (tempLogger == null)
            {
                throw new NullReferenceException(string.Format("log4net instance not found for {0} logger instance", loggerInstance));
            }

            switch (l.Severity)
            {
            case SeverityLevel.Debug:
                tempLogger.Debug(l.ToString());
                break;

            case SeverityLevel.Warn:
                tempLogger.Warn(l.ToString());
                break;

            case SeverityLevel.Info:
                tempLogger.Info(l.ToString());
                break;

            case SeverityLevel.Error:
                tempLogger.Error(l.ToString());
                break;

            case SeverityLevel.Fatal:
                tempLogger.Fatal(l.ToString());
                break;

            default:
                tempLogger.Debug(l.ToString());
                break;
            }
        }
示例#5
0
        public void DeserializeFromXMLTestLog4NetConfiguration()
        {
            Log4NetConfiguration log4NetConfigRoot = LoggingSettings.Instance.Config.Log4NetConfigurations.FirstOrDefault(x => x.LogName == LoggerInstanceConstants.MainLoggerInstance);
            Log4NetConfiguration log4NetConfigReq  = LoggingSettings.Instance.Config.Log4NetConfigurations.FirstOrDefault(x => x.LogName == LoggerInstanceConstants.RequestLoggerInstance);
            Log4NetConfiguration log4NetConfigRep  = LoggingSettings.Instance.Config.Log4NetConfigurations.FirstOrDefault(x => x.LogName == LoggerInstanceConstants.ReplyLoggerInstance);

            Assert.IsNotNull(log4NetConfigRoot);
            Assert.IsNotNull(log4NetConfigReq);
            Assert.IsNotNull(log4NetConfigRep);

            Assert.AreEqual(SeverityLevel.Debug, log4NetConfigRoot.VerbosityLevel);
            Assert.AreEqual(SeverityLevel.Debug, log4NetConfigReq.VerbosityLevel);
            Assert.AreEqual(SeverityLevel.Debug, log4NetConfigRep.VerbosityLevel);

            Assert.AreEqual(true, log4NetConfigRoot.IsEnabled);
            Assert.AreEqual(true, log4NetConfigReq.IsEnabled);
            Assert.AreEqual(true, log4NetConfigRep.IsEnabled);
        }
示例#6
0
        public static void SetUp()
        {
            Log4NetConfiguration.InitializeOnce();
            var templateDirectory = Path.Combine(FindCassandraTemplateDirectory(AppDomain.CurrentDomain.BaseDirectory), @"v3.11.x");
            var deployDirectory   = Path.Combine(Path.GetTempPath(), "deployed_cassandra_v3.11.x");

            node = new LocalCassandraNode(templateDirectory, deployDirectory)
            {
                RpcPort    = 9360,
                CqlPort    = 9343,
                JmxPort    = 7399,
                GossipPort = 7400,
            };
            node.Restart(timeout: TimeSpan.FromMinutes(1));

            var logger = Log4NetConfiguration.RootLogger.ForContext(nameof(SingleCassandraNodeSetUpFixture));

            cassandraCluster = new CassandraCluster(CreateCassandraClusterSettings(), logger);

            var cassandraSchemaActualizer = new CassandraSchemaActualizer(cassandraCluster, eventListener: null, logger);

            cassandraSchemaActualizer.ActualizeKeyspaces(new[]
            {
                new KeyspaceSchema
                {
                    Name          = RemoteLockKeyspace,
                    Configuration = new KeyspaceConfiguration
                    {
                        ReplicationStrategy = SimpleReplicationStrategy.Create(replicationFactor: 1),
                        ColumnFamilies      = new[]
                        {
                            new ColumnFamily
                            {
                                Name    = RemoteLockColumnFamily,
                                Caching = ColumnFamilyCaching.KeysOnly
                            }
                        }
                    }
                }
            }, changeExistingKeyspaceMetadata: false);
        }
示例#7
0
 public AppenderFactory(Log4NetConfiguration configuration)
 {
     this.configuration = configuration;
 }
        //static ILoggingBuilder Log4NetLogger(this ILoggingBuilder builder, Action<Log4NetConfiguration> configure)
        //{
        //    var config = new Log4NetConfiguration();

        //    configure(config);

        //    return builder.Log4NetLogger(config);
        //}

        static ILoggingBuilder Log4NetLogger(this ILoggingBuilder builder, Log4NetConfiguration config)
        {
            builder.AddProvider(new Log4NetProvider(config));

            return(builder);
        }
        public void ResolveTheLog4NetConfig()
        {
            var log4NetConfiguration = new Log4NetConfiguration();

            Assert.IsNotNull(log4NetConfiguration);
        }
 static AutoRollbackDatabaseTest()
 {
     Log4NetConfiguration.Configure();
 }