public static LogFilterPipeline GetFilterPipeLine(LogConfigurationElementCollection filterElements)
        {
            //rwlock.AcquireReaderLock(defaultLockTimeout);
            try
            {
                LogFilterPipeline pipeline = new LogFilterPipeline();

                if (filterElements != null)
                {
                    foreach (LogConfigurationElement ele in filterElements)
                    {
                        ILogFilter filter = GetFilterFromConfig(ele);

                        if (filter != null)
                        {
                            pipeline.Add(filter);
                        }
                    }
                }

                return(pipeline);
            }
            catch (Exception ex)
            {
                throw new LogException("创建FilterPipeline时发生错误:" + ex.Message, ex);
            }
            //finally
            //{
            //    rwlock.ReleaseReaderLock();
            //}
        }
Beispiel #2
0
        private void CreateFilterElementCollection(System.Xml.XmlReader reader)
        {
            LogConfigurationElementCollection logFilterElementCollection = new LogConfigurationElementCollection(this.Name + "~Filters");

            logFilterElementCollection.DeserializeElementDirectly(reader, false);

            this.dicRWLock.AcquireWriterLock(1000);
            try
            {
                elementCollectionDic.Add(this.Name + "~Filters", logFilterElementCollection);
            }
            finally
            {
                this.dicRWLock.ReleaseWriterLock();
            }
        }