private SLog(SerializationInfo info, StreamingContext context) { _loggerName = (string)info.GetValue("loggerName", typeof(string)); _domainName = (string)info.GetValue("domainName", typeof(string)); _properties = (PropertiesDictionary)info.GetValue("properties", typeof(PropertiesDictionary)); SLogManager.CreateDomainIfNeeded(_domainName); // We don't want to go through SLogManager, because we want to inject THIS deserialized // instance into SLogManager's map. _logger = LogManager.GetLogger(_domainName, _loggerName).Logger; _configMethod = (ConfigMethod)info.GetValue("configMethod", typeof(int)); if (_configMethod == ConfigMethod.RegistryConfigurator) { log4net.Ext.Config.RegistryConfigurator.ConfigureAndWatch(_domainName, _domainName); } if (_configMethod == ConfigMethod.AppConfigConfigurator) { log4net.Ext.Config.AppConfigConfigurator.ConfigureAndWatch(_domainName, _domainName); //log4net.Config.XmlConfigurator.Configure(); } // Get this deserialized instance to the wrapper map so it will be used by others asking for a // logger of the same name. SLogManager.AddToMap(_logger, this); //System.Diagnostics.Trace.WriteLine("Deserializing SLog..." + this.GetHashCode() + ":" + descount++); }
/// <summary> /// This logger offers the ability to use at least one configurator, so it can store /// state information about how log4net was configured to be used if the appdomain is recycled. /// </summary> /// <param name="registryPath"></param> public void RegistryConfigurator() { _configMethod = ConfigMethod.RegistryConfigurator; // Here, we are making our domain name be equal to the registry path used for configuration. log4net.Ext.Config.RegistryConfigurator.ConfigureAndWatch(_domainName, _domainName); }
public void AppConfigConfigurator() { _configMethod = ConfigMethod.AppConfigConfigurator; // Here, we are making our domain name be equal to the App.Settings key used for configuration. log4net.Ext.Config.AppConfigConfigurator.ConfigureAndWatch(_domainName, _domainName); //log4net.Config.XmlConfigurator.Configure(); }
public static void RegisterConfigMethod(ConfigMethod method) { _configMethod = method; }