예제 #1
0
        public TableManager(IConfigManagerHelper config)
        {
            var azureDataConnectionString = config.GetAppSetting("DataConnectionString");
            var storageAccount            = CloudStorageAccount.Parse(azureDataConnectionString);

            _tableClient = storageAccount.CreateCloudTableClient();
        }
        public OneHydraLogger(string loggerName, IConfigManagerHelper config)
        {
            var hier = LogManager.GetRepository() as Hierarchy;
            // If we have the setting in the configuration set the log level.  Otherwise, default to only errors and fatal
            // debug messages.
            if (hier != null)
            {
                var logLevel = hier.LevelMap["ERROR"];
                var configLogLevel = config.GetAppSetting("OneHydraLogLevel");
                if (configLogLevel != null)
                {
                    logLevel = hier.LevelMap[configLogLevel.ToUpper()];
                }

                // Only do this once when the first instance is created.  After that, the adoAppender should be available
                // to all subsequent instantiations.  We're also only setting the log level for the entire configuration once.
                // If subsequently, someone uses log4net and usurps the hierarchy in the architecture, it could change the log level.     
                lock (ConfigureLock)
                {
                    if (_adoAppender == null)
                    {
                        _adoAppender = GetAdoAppender(config);
                        log4net.Config.BasicConfigurator.Configure(_adoAppender);
                        ILogger[] loggers = hier.GetCurrentLoggers();
                        foreach (var logger in loggers)
                        {
                            ((Logger)logger).Level = logLevel;
                        }
                        //Configure the root logger.
                        Logger rootLogger = hier.Root;
                        rootLogger.Level = logLevel;
                    }

                }

                // Set the appender and log level for this instance.  We know they should already be configured.
                var loggerToConfigure = hier.GetLogger(loggerName, hier.LoggerFactory);
                if (loggerToConfigure != null)
                {
                    loggerToConfigure.Level = logLevel;
                    _logger = LogManager.GetLogger(loggerName);

                }
            }
        }
예제 #3
0
        public OneHydraLogger(string loggerName, IConfigManagerHelper config)
        {
            var hier = LogManager.GetRepository() as Hierarchy;

            // If we have the setting in the configuration set the log level.  Otherwise, default to only errors and fatal
            // debug messages.
            if (hier != null)
            {
                var logLevel       = hier.LevelMap["ERROR"];
                var configLogLevel = config.GetAppSetting("OneHydraLogLevel");
                if (configLogLevel != null)
                {
                    logLevel = hier.LevelMap[configLogLevel.ToUpper()];
                }

                // Only do this once when the first instance is created.  After that, the adoAppender should be available
                // to all subsequent instantiations.  We're also only setting the log level for the entire configuration once.
                // If subsequently, someone uses log4net and usurps the hierarchy in the architecture, it could change the log level.
                lock (ConfigureLock)
                {
                    if (_adoAppender == null)
                    {
                        _adoAppender = GetAdoAppender(config);
                        log4net.Config.BasicConfigurator.Configure(_adoAppender);
                        ILogger[] loggers = hier.GetCurrentLoggers();
                        foreach (var logger in loggers)
                        {
                            ((Logger)logger).Level = logLevel;
                        }
                        //Configure the root logger.
                        Logger rootLogger = hier.Root;
                        rootLogger.Level = logLevel;
                    }
                }

                // Set the appender and log level for this instance.  We know they should already be configured.
                var loggerToConfigure = hier.GetLogger(loggerName, hier.LoggerFactory);
                if (loggerToConfigure != null)
                {
                    loggerToConfigure.Level = logLevel;
                    _logger = LogManager.GetLogger(loggerName);
                }
            }
        }
 public BlobManager(IConfigManagerHelper config)
 {
     var azureDataConnectionString = config.GetAppSetting("DataConnectionString");
     var storageAccount = CloudStorageAccount.Parse(azureDataConnectionString);
     _blobClient = storageAccount.CreateCloudBlobClient();
 }