static LogManager() { _logger = new NCacheLogger(); _logger.Initialize(LoggerNames.MemcacheGateway); string loggingLevel = System.Configuration.ConfigurationManager.AppSettings["LoggingLevel"]; if (!string.IsNullOrEmpty(loggingLevel)) { _logger.SetLevel(loggingLevel); } else { _logger.SetLevel("Info"); } }
protected internal void Configure(LogLevel logLevel, string path) { if (!isConfigured) { this.logLevel = logLevel; if (path != null) { if (File.Exists(path)) { throw new Exception("The specified location for logging is not a directory but a path to a file."); } if (!Directory.Exists(path)) { throw new Exception("The directory specified for logging does not exist."); } this.path = path; } #if JAVA this.path = Path.Combine(this.path, @"log"); #else this.path = Path.Combine(this.path, @"log-files"); #endif this.path = Path.Combine(this.path, @"EFCoreLogs"); if (!Directory.Exists(this.path)) { Directory.CreateDirectory(this.path); } IDictionary properties = new Dictionary <string, string> { ["log-path"] = this.path }; nCacheLogger = new NCacheLogger(); nCacheLogger.Initialize(properties, NCacheConfiguration.CacheId, "EFCoreLogs"); string logLevelLog4Net = default(string); switch (logLevel) { case LogLevel.Trace: logLevelLog4Net = LoggerLevel.All; break; case LogLevel.Debug: logLevelLog4Net = LoggerLevel.Debug; break; case LogLevel.Information: logLevelLog4Net = LoggerLevel.Info; break; case LogLevel.Warning: logLevelLog4Net = LoggerLevel.Warn; break; case LogLevel.Error: logLevelLog4Net = LoggerLevel.Error; break; case LogLevel.Critical: logLevelLog4Net = LoggerLevel.CriticalInfo; break; case LogLevel.None: logLevelLog4Net = LoggerLevel.Off; break; } if (string.IsNullOrEmpty(logLevelLog4Net)) { logLevelLog4Net = LoggerLevel.Off; } nCacheLogger.SetLevel(logLevelLog4Net); isConfigured = true; } }