• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ILoggerRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ILoggerRepository的典型用法代码示例。如果您正苦于以下问题:C# ILoggerRepository类的具体用法?C# ILoggerRepository怎么用?C# ILoggerRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ILoggerRepository类属于命名空间,在下文中一共展示了ILoggerRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConfigureAndWatchHandler

			public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
			{
				m_repository = repository;
				m_configFile = configFile;

				// Create a new FileSystemWatcher and set its properties.
				m_watcher = new FileSystemWatcher();

				m_watcher.Path = m_configFile.DirectoryName;
				m_watcher.Filter = m_configFile.Name;

				// Set the notification filters
				m_watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.FileName;

				// Add event handlers. OnChanged will do for all event handlers that fire a FileSystemEventArgs
				m_watcher.Changed += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
				m_watcher.Created += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
				m_watcher.Deleted += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
				m_watcher.Renamed += new RenamedEventHandler(ConfigureAndWatchHandler_OnRenamed);

				// Begin watching.
				m_watcher.EnableRaisingEvents = true;

				// Create the timer that will be used to deliver events. Set as disabled
				m_timer = new Timer(new TimerCallback(OnWatchedFileChange), null, Timeout.Infinite, Timeout.Infinite);
			}
开发者ID:GregoryMaks,项目名称:log4net-201310,代码行数:26,代码来源:XmlConfigurator.ConfigureAndWatchHandler.ClientProfile.WF.cs


示例2: RegisterLogging

        /// <summary>
        ///		Registers loggers within the <see cref="AppDomain"/>
        /// and creates the <see cref="ILoggerRepository"/> using 
        /// provided <paramref name="loggerConfiguration"/>.
        /// 
        /// Sample logging welcome message is done using <paramref name="type"/>
        /// </summary>
        /// <param name="loggerConfiguration"></param>
        /// <param name="type"></param>
        public void RegisterLogging(string loggerConfiguration, Type type)
        {
            try
            {
                _repository = LogManager.CreateRepository(NomadConstants.NOMAD_LOGGER_REPOSITORY);
            }
            catch (LogException)
            {
                // the repository is already defined
                // this situation should not happen in real life situation
                // but can occur in syntetic testing
                _logger = LogManager.GetLogger(NomadConstants.NOMAD_LOGGER_REPOSITORY, type);
                return;
            }

            try
            {
                var file = new FileInfo(loggerConfiguration);
                XmlConfigurator.Configure(_repository, file);
            }
            catch (Exception)
            {
                // NOTE: eat the exception here - fallback mechanism if user not specified other ways
                BasicConfigurator.Configure(_repository);
            }

            _logger = LogManager.GetLogger(NomadConstants.NOMAD_LOGGER_REPOSITORY, type);
            _logger.Info("The modules logger is enabled at levels:");

            _logger.Info(string.Format("Debug: {0}", _logger.IsDebugEnabled));
            _logger.Info(string.Format("Info: {0}", _logger.IsInfoEnabled));
            _logger.Info(string.Format("Warn: {0}", _logger.IsWarnEnabled));
            _logger.Info(string.Format("Error: {0}", _logger.IsErrorEnabled));
            _logger.Info(string.Format("Fatal: {0}", _logger.IsFatalEnabled));
        }
开发者ID:NomadPL,项目名称:Nomad,代码行数:44,代码来源:LoggingHelper.cs


示例3: CreateLogger

		/// <summary>
		/// Create a new <see cref="Logger" /> instance
		/// </summary>
		/// <param name="repository">The <see cref="ILoggerRepository" /> that will own the <see cref="Logger" />.</param>
		/// <param name="name">The name of the <see cref="Logger" />.</param>
		/// <returns>The <see cref="Logger" /> instance for the specified name.</returns>
		/// <remarks>
		/// <para>
		/// Create a new <see cref="Logger" /> instance with the 
		/// specified name.
		/// </para>
		/// <para>
		/// Called by the <see cref="Hierarchy"/> to create
		/// new named <see cref="Logger"/> instances.
		/// </para>
		/// <para>
		/// If the <paramref name="name"/> is <c>null</c> then the root logger
		/// must be returned.
		/// </para>
		/// </remarks>
		public Logger CreateLogger(ILoggerRepository repository, string name) 
		{
			if (name == null)
			{
				return new RootLogger(repository.LevelMap.LookupWithDefault(Level.Debug));
			}
			return new LoggerImpl(name);
		}
开发者ID:ZhenghaiYe,项目名称:iveely,代码行数:28,代码来源:DefaultLoggerFactory.cs


示例4: ReloadLevels

		private void ReloadLevels(ILoggerRepository repository)
		{
			LevelMap levelMap = repository.LevelMap;

			m_levelDebug = levelMap.LookupWithDefault(Level.Debug);
			m_levelInfo = levelMap.LookupWithDefault(Level.Info);
			m_levelWarn = levelMap.LookupWithDefault(Level.Warn);
			m_levelError = levelMap.LookupWithDefault(Level.Error);
			m_levelFatal = levelMap.LookupWithDefault(Level.Fatal);
		}
开发者ID:Redi0,项目名称:meijing-ui,代码行数:10,代码来源:MarshalByRefLogImpl.cs


示例5: Configure

		/// <summary>
		/// Configures the SecurityContextProvider
		/// </summary>
		/// <param name="sourceAssembly">The assembly that this attribute was defined on.</param>
		/// <param name="targetRepository">The repository to configure.</param>
		/// <remarks>
		/// <para>
		/// Creates a provider instance from the <see cref="ProviderType"/> specified.
		/// Sets this as the default security context provider <see cref="SecurityContextProvider.DefaultProvider"/>.
		/// </para>
		/// </remarks>
		override public void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository) {
			if (m_providerType == null) {
				LogLog.Error(declaringType, "Attribute specified on assembly [" + sourceAssembly.FullName + "] with null ProviderType.");
			} else {
				LogLog.Debug(declaringType, "Creating provider of type [" + m_providerType.FullName + "]");

				SecurityContextProvider provider = Activator.CreateInstance(m_providerType) as SecurityContextProvider;

				if (provider == null) {
					LogLog.Error(declaringType, "Failed to create SecurityContextProvider instance of type [" + m_providerType.Name + "].");
				} else {
					SecurityContextProvider.DefaultProvider = provider;
				}
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:26,代码来源:SecurityContextProviderAttribute.cs


示例6: Attach

		/// <summary>
		/// Attaches this plugin to a <see cref="ILoggerRepository"/>.
		/// </summary>
		/// <param name="repository">The <see cref="ILoggerRepository"/> that this plugin should be attached to.</param>
		/// <remarks>
		/// <para>
		/// A plugin may only be attached to a single repository.
		/// </para>
		/// <para>
		/// This method is called when the plugin is attached to the repository.
		/// </para>
		/// </remarks>
		override public void Attach(ILoggerRepository repository)
		{
			base.Attach(repository);

			// Create the sink and marshal it
			m_sink = new RemoteLoggingSinkImpl(repository); 

			try
			{
				RemotingServices.Marshal(m_sink, m_sinkUri, typeof(log4net.Appender.RemotingAppender.IRemoteLoggingSink));		
			}
			catch(Exception ex)
			{
				LogLog.Error("RemoteLoggingServerPlugin: Failed to Marshal remoting sink", ex);
			}
		}
开发者ID:WolfeReiter,项目名称:clamav-csharp-client,代码行数:28,代码来源:RemoteLoggingServerPlugin.cs


示例7: LogWriter

        public LogWriter(ILoggerRepository loggerRepository, object source)
        {
            if (loggerRepository == null)
            {
                throw new ArgumentNullException("loggerRepository");
            }

            this.loggerRepository = loggerRepository;

            if (source != null)
            {
                sourceType = source.GetType();
            }
            else
            {
                sourceType = MethodBase.GetCurrentMethod().DeclaringType;
            }
        }
开发者ID:affecto,项目名称:dotnet-Logging,代码行数:18,代码来源:LogWriter.cs


示例8: ReloadLevels

            private static void ReloadLevels(ILoggerRepository repository)
            {
                LevelMap levelMap = repository.LevelMap;

                _levelTrace = levelMap.LookupWithDefault(Level.Trace);
                _levelDebug = levelMap.LookupWithDefault(Level.Debug);
                _levelInfo = levelMap.LookupWithDefault(Level.Info);
                _levelWarn = levelMap.LookupWithDefault(Level.Warn);
                _levelError = levelMap.LookupWithDefault(Level.Error);
                _levelFatal = levelMap.LookupWithDefault(Level.Fatal);
//                LevelLogError = levelMap.LookupWithDefault(LevelLogError);
//                LevelLogInfo = levelMap.LookupWithDefault(LevelLogInfo);

                //// Register custom logging levels with the default LoggerRepository
//                LogManager.GetRepository().LevelMap.Add(LevelLogInfo);
//                LogManager.GetRepository().LevelMap.Add(LevelLogError);

            }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:18,代码来源:LoggerSourceImpl.cs


示例9: GetReconstructedLoggingEvent

        public LoggingEvent GetReconstructedLoggingEvent(ILoggerRepository renderingRepo)
        {
            LoggingEvent ret = new LoggingEvent(null, renderingRepo, null, _LoggingEvent.Level, _MessageObject, _LoggedException);

            BindingFlags eFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
            FieldInfo pi;

            LoggingEventData data = _LoggingEvent.GetLoggingEventData(FixFlags.None);
            //reset message so it gets rendered again
            data.Message = null;

            pi = ret.GetType().GetField("m_data", eFlags);
            if (pi != null)
            {
                pi.SetValue(ret, data);
            }

            //reflectivly set the rest of the properties.
            ret.Fix = FixFlags.Exception | FixFlags.Message;
            return ret;
        }
开发者ID:edwinf,项目名称:WCFAppender-log4net,代码行数:21,代码来源:LogEventWrapper.cs


示例10: Configure

		/// <summary>
		/// Automatically configures the <see cref="ILoggerRepository"/> using settings
		/// stored in the application's configuration file.
		/// </summary>
		/// <remarks>
		/// Each application has a configuration file. This has the
		/// same name as the application with '.config' appended.
		/// This file is XML and calling this function prompts the
		/// configurator to look in that file for a section called
		/// <c>log4net</c> that contains the configuration data.
		/// </remarks>
		/// <param name="repository">The repository to configure.</param>
		static public void Configure(ILoggerRepository repository) 
		{
			LogLog.Debug("DOMConfigurator: configuring repository [" + repository.Name + "] using .config file section");

			try
			{
				LogLog.Debug("DOMConfigurator: Application config file is [" + SystemInfo.ConfigurationFileLocation + "]");
			}
			catch
			{
				// ignore error
				LogLog.Debug("DOMConfigurator: Application config file location unknown");
			}

#if NETCF
			// No config file reading stuff. Just go straight for the file
			Configure(repository, new FileInfo(SystemInfo.ConfigurationFileLocation));
#else
			try
			{
				ConfigureFromXML(repository, (XmlElement) System.Configuration.ConfigurationSettings.GetConfig("log4net"));
			}
			catch(System.Configuration.ConfigurationException confEx)
			{
				if (confEx.BareMessage.IndexOf("Unrecognized element") >= 0)
				{
					// Looks like the XML file is not valid
					LogLog.Error("DOMConfigurator: Failed to parse config file. Check your .config file is well formed XML.", confEx);
				}
				else
				{
					// This exception is typically due to the assembly name not being correctly specified in the section type.
					string configSectionStr = "<section name=\"log4net\" type=\"log4net.Config.Log4NetConfigurationSectionHandler," + Assembly.GetExecutingAssembly().FullName + "\" />";
					LogLog.Error("DOMConfigurator: Failed to parse config file. Is the <configSections> specified as: " + configSectionStr, confEx);
				}
			}
#endif
		}
开发者ID:WolfeReiter,项目名称:clamav-csharp-client,代码行数:50,代码来源:DOMConfigurator.cs


示例11: OnLoggerRepositoryCreatedEvent

		/// <summary>
		/// Notify the registered listeners that the repository has been created
		/// </summary>
		/// <param name="repository">The repository that has been created</param>
		/// <remarks>
		/// <para>
		/// Raises the <event cref="LoggerRepositoryCreatedEvent">LoggerRepositoryCreatedEvent</event>
		/// event.
		/// </para>
		/// </remarks>
		protected virtual void OnLoggerRepositoryCreatedEvent(ILoggerRepository repository)
		{
			LoggerRepositoryCreationEventHandler handler = m_loggerRepositoryCreatedEvent;
			if (handler != null)
			{
				handler(this, new LoggerRepositoryCreationEventArgs(repository));
			}
		}
开发者ID:Redi0,项目名称:meijing-ui,代码行数:18,代码来源:CompactRepositorySelector.cs


示例12: GetAllRepositories

		/// <summary>
		/// Gets a list of <see cref="ILoggerRepository"/> objects
		/// </summary>
		/// <returns>an array of all known <see cref="ILoggerRepository"/> objects</returns>
		/// <remarks>
		/// <para>
		/// Gets an array of all of the repositories created by this selector.
		/// </para>
		/// </remarks>
		public ILoggerRepository[] GetAllRepositories()
		{
			lock(this)
			{
				ICollection reps = m_name2repositoryMap.Values;
				ILoggerRepository[] all = new ILoggerRepository[reps.Count];
				reps.CopyTo(all, 0);
				return all;
			}
		}
开发者ID:Redi0,项目名称:meijing-ui,代码行数:19,代码来源:CompactRepositorySelector.cs


示例13: ConfigureFromXml

		/// <summary>
		/// Configures the specified repository using a <c>log4net</c> element.
		/// </summary>
		/// <param name="repository">The hierarchy to configure.</param>
		/// <param name="element">The element to parse.</param>
		/// <remarks>
		/// <para>
		/// Loads the log4net configuration from the XML element
		/// supplied as <paramref name="element"/>.
		/// </para>
		/// <para>
		/// This method is ultimately called by one of the Configure methods 
		/// to load the configuration from an <see cref="XmlElement"/>.
		/// </para>
		/// </remarks>
		static private void ConfigureFromXml(ILoggerRepository repository, XmlElement element) 
		{
			if (element == null)
			{
				LogLog.Error("XmlConfigurator: ConfigureFromXml called with null 'element' parameter");
			}
			else if (repository == null)
			{
				LogLog.Error("XmlConfigurator: ConfigureFromXml called with null 'repository' parameter");
			}
			else
			{
				LogLog.Debug("XmlConfigurator: Configuring Repository [" + repository.Name + "]");

				IXmlRepositoryConfigurator configurableRepository = repository as IXmlRepositoryConfigurator;
				if (configurableRepository == null)
				{
					LogLog.Warn("XmlConfigurator: Repository [" + repository + "] does not support the XmlConfigurator");
				}
				else
				{
					// Copy the xml data into the root of a new document
					// this isolates the xml config data from the rest of
					// the document
					XmlDocument newDoc = new XmlDocument();
					XmlElement newElement = (XmlElement)newDoc.AppendChild(newDoc.ImportNode(element, true));

					// Pass the configurator the config element
					configurableRepository.Configure(newElement);
				}			
			}
		}
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:47,代码来源:XmlConfigurator.cs


示例14: ConfigureAndWatch

		/// <summary>
		/// Configures the <see cref="ILoggerRepository"/> using the file specified, 
		/// monitors the file for changes and reloads the configuration if a change 
		/// is detected.
		/// </summary>
		/// <param name="repository">The repository to configure.</param>
		/// <param name="configFile">The XML file to load the configuration from.</param>
		/// <remarks>
		/// <para>
		/// The configuration file must be valid XML. It must contain
		/// at least one element called <c>log4net</c> that holds
		/// the configuration data.
		/// </para>
		/// <para>
		/// The configuration file will be monitored using a <see cref="FileSystemWatcher"/>
		/// and depends on the behavior of that class.
		/// </para>
		/// <para>
		/// For more information on how to configure log4net using
		/// a separate configuration file, see <see cref="Configure(FileInfo)"/>.
		/// </para>
		/// </remarks>
		/// <seealso cref="Configure(FileInfo)"/>
		static public void ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile)
		{
			LogLog.Debug("XmlConfigurator: configuring repository [" + repository.Name + "] using file [" + configFile + "] watching for file updates");

			if (configFile == null)
			{
				LogLog.Error("XmlConfigurator: ConfigureAndWatch called with null 'configFile' parameter");
			}
			else
			{
				// Configure log4net now
				Configure(repository, configFile);

				try
				{
					// Create a watch handler that will reload the
					// configuration whenever the config file is modified.
					ConfigureAndWatchHandler.StartWatching(repository, configFile);
				}
				catch(Exception ex)
				{
					LogLog.Error("XmlConfigurator: Failed to initialize configuration file watcher for file ["+configFile.FullName+"]", ex);
				}
			}
		}
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:48,代码来源:XmlConfigurator.cs


示例15: StartWatching

			/// <summary>
			/// Watch a specified config file used to configure a repository
			/// </summary>
			/// <param name="repository">The repository to configure.</param>
			/// <param name="configFile">The configuration file to watch.</param>
			/// <remarks>
			/// <para>
			/// Watch a specified config file used to configure a repository
			/// </para>
			/// </remarks>
			internal static void StartWatching(ILoggerRepository repository, FileInfo configFile)
			{
				new ConfigureAndWatchHandler(repository, configFile);
			}
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:14,代码来源:XmlConfigurator.cs


示例16: Configure

		/// <summary>
		/// Configures the <see cref="ILoggerRepository"/> using the specified configuration 
		/// URI.
		/// </summary>
		/// <param name="repository">The repository to configure.</param>
		/// <param name="configUri">A URI to load the XML configuration from.</param>
		/// <remarks>
		/// <para>
		/// The configuration data must be valid XML. It must contain
		/// at least one element called <c>log4net</c> that holds
		/// the configuration data.
		/// </para>
		/// <para>
		/// The <see cref="System.Net.WebRequest"/> must support the URI scheme specified.
		/// </para>
		/// </remarks>
		static public void Configure(ILoggerRepository repository, Uri configUri)
		{
			LogLog.Debug("XmlConfigurator: configuring repository [" + repository.Name + "] using URI ["+configUri+"]");

			if (configUri == null)
			{
				LogLog.Error("XmlConfigurator: Configure called with null 'configUri' parameter");
			}
			else
			{
				if (configUri.IsFile)
				{
					// If URI is local file then call Configure with FileInfo
					Configure(repository, new FileInfo(configUri.LocalPath));
				}
				else
				{
					// NETCF dose not support WebClient
					WebRequest configRequest = null;

					try
					{
						configRequest = WebRequest.Create(configUri);
					}
					catch(Exception ex)
					{
						LogLog.Error("XmlConfigurator: Failed to create WebRequest for URI ["+configUri+"]", ex);
					}

					if (configRequest != null)
					{
#if !NETCF
						// authentication may be required, set client to use default credentials
						try
						{
							configRequest.Credentials = CredentialCache.DefaultCredentials;
						}
						catch
						{
							// ignore security exception
						}
#endif
						try
						{
							WebResponse response = configRequest.GetResponse();
							if (response != null)
							{
								try
								{
									// Open stream on config URI
									using(Stream configStream = response.GetResponseStream())
									{
										Configure(repository, configStream);
									}
								}
								finally
								{
									response.Close();
								}
							}
						}
						catch(Exception ex)
						{
							LogLog.Error("XmlConfigurator: Failed to request config from URI ["+configUri+"]", ex);
						}
					}
				}
			}
		}
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:85,代码来源:XmlConfigurator.cs


示例17: ConfigureFromUri

		/// <summary>
		/// Attempt to load configuration from a URI
		/// </summary>
		/// <param name="sourceAssembly">The assembly that this attribute was defined on.</param>
		/// <param name="targetRepository">The repository to configure.</param>
		private void ConfigureFromUri(Assembly sourceAssembly, ILoggerRepository targetRepository)
		{
			// Work out the full path to the config file
			Uri fullPath2ConfigFile = null;
			
			// Select the config file
			if (m_configFile == null || m_configFile.Length == 0)
			{
				if (m_configFileExtension == null || m_configFileExtension.Length == 0)
				{
					string systemConfigFilePath = null;
					try
					{
						systemConfigFilePath = SystemInfo.ConfigurationFileLocation;
					}
					catch(Exception ex)
					{
						LogLog.Error(declaringType, "XmlConfiguratorAttribute: Exception getting ConfigurationFileLocation. Must be able to resolve ConfigurationFileLocation when ConfigFile and ConfigFileExtension properties are not set.", ex);
					}

					if (systemConfigFilePath != null)
					{
						Uri systemConfigFileUri = new Uri(systemConfigFilePath);

						// Use the default .config file for the AppDomain
						fullPath2ConfigFile = systemConfigFileUri;
					}
				}
				else
				{
					// Force the extension to start with a '.'
					if (m_configFileExtension[0] != '.')
					{
						m_configFileExtension = "." + m_configFileExtension;
					}

					string systemConfigFilePath = null;
					try
					{
						systemConfigFilePath = SystemInfo.ConfigurationFileLocation;
					}
					catch(Exception ex)
					{
						LogLog.Error(declaringType, "XmlConfiguratorAttribute: Exception getting ConfigurationFileLocation. Must be able to resolve ConfigurationFileLocation when the ConfigFile property are not set.", ex);
					}

					if (systemConfigFilePath != null)
					{
						UriBuilder builder = new UriBuilder(new Uri(systemConfigFilePath));

						// Remove the current extension from the systemConfigFileUri path
						string path = builder.Path;
						int startOfExtension = path.LastIndexOf(".");
						if (startOfExtension >= 0)
						{
							path = path.Substring(0, startOfExtension);
						}
						path += m_configFileExtension;

						builder.Path = path;
						fullPath2ConfigFile = builder.Uri;
					}
				}
			}
			else
			{
				string applicationBaseDirectory = null;
				try
				{
					applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
				}
				catch(Exception ex)
				{
					LogLog.Warn(declaringType, "Exception getting ApplicationBaseDirectory. ConfigFile property path ["+m_configFile+"] will be treated as an absolute URI.", ex);
				}

				if (applicationBaseDirectory != null)
				{
					// Just the base dir + the config file
					fullPath2ConfigFile = new Uri(new Uri(applicationBaseDirectory), m_configFile);
				}
				else
				{
					fullPath2ConfigFile = new Uri(m_configFile);
				}
			}

			if (fullPath2ConfigFile != null)
			{
				if (fullPath2ConfigFile.IsFile)
				{
					// The m_configFile could be an absolute local path, therefore we have to be
					// prepared to switch back to using FileInfos here
					ConfigureFromFile(targetRepository, new FileInfo(fullPath2ConfigFile.LocalPath));
				}
//.........这里部分代码省略.........
开发者ID:KebinuChiousu,项目名称:MangaCrawler,代码行数:101,代码来源:XmlConfiguratorAttribute.cs


示例18: ConfigureFromFile

		/// <summary>
		/// Configure the specified repository using a <see cref="FileInfo"/>
		/// </summary>
		/// <param name="targetRepository">The repository to configure.</param>
		/// <param name="configFile">the FileInfo pointing to the config file</param>
		private void ConfigureFromFile(ILoggerRepository targetRepository, FileInfo configFile)
		{
#if (SSCLI)
			if (m_configureAndWatch)
			{
				LogLog.Warn(declaringType, "XmlConfiguratorAttribute: Unable to watch config file not supported on SSCLI");
			}
			XmlConfigurator.Configure(targetRepository, configFile);
#else
			// Do we configure just once or do we configure and then watch?
			if (m_configureAndWatch)
			{
				XmlConfigurator.ConfigureAndWatch(targetRepository, configFile);
			}
			else
			{
				XmlConfigurator.Configure(targetRepository, configFile);
			}
#endif
		}
开发者ID:KebinuChiousu,项目名称:MangaCrawler,代码行数:25,代码来源:XmlConfiguratorAttribute.cs


示例19: LogManager

 public LogManager(ServerCore parent, FileInfo configFile)
 {
     this._logs = new Dictionary<String, Log>();
     this.Parent = parent;
     XmlConfigurator.ConfigureAndWatch(configFile);
     this._repository = log4net.LogManager.GetRepository();
 }
开发者ID:takeshik,项目名称:metatweet-old,代码行数:7,代码来源:LogManager.cs


示例20: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            appender = new AsyncAdoAppender
            {
                CommandType = CommandType.Text,
                ConnectionString = connectionString,
                CommandText = commandText,
                ConnectionType = connectionType
            };

            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.DateTime, ParameterName = "@log_date", Layout = new RawUtcTimeStampLayout() });
            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.String, Size = 255, ParameterName = "@thread", Layout = new Layout2RawLayoutAdapter(new PatternLayout("%thread")) });
            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.String, Size = 40, ParameterName = "@log_level", Layout = new Layout2RawLayoutAdapter(new PatternLayout("%level")) });
            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.String, Size = 255, ParameterName = "@logger", Layout = new Layout2RawLayoutAdapter(new PatternLayout("%logger")) });
            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.String, Size = 4000, ParameterName = "@message", Layout = new Layout2RawLayoutAdapter(new PatternLayout("%message")) });
            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.String, Size = 4000, ParameterName = "@exception", Layout = new Layout2RawLayoutAdapter(new PatternLayout("%exception")) });
            appender.AddParameter(new AdoNetAppenderParameter { DbType = DbType.String, Size = 200, ParameterName = "@application", Layout = new Layout2RawLayoutAdapter(new PatternLayout(ApplicationName)) });

            appender.Threshold = ErrorLevel;
            appender.BufferSize = -1;
            appender.ActivateOptions();

            rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
            BasicConfigurator.Configure(rep, appender);
            LogsDBAccess.RemoveMatchingLogEntries(ErrorLevel, ErrorMessage, ApplicationName);
        }
开发者ID:JohnDRoach,项目名称:Log4Net.Async,代码行数:26,代码来源:AsyncAdoAppenderTest.cs



注:本文中的ILoggerRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ILoggerService类代码示例发布时间:2022-05-24
下一篇:
C# ILoggerFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap