public static List <FormattedTraceListenerBase> GetListeners(LoggerListenerConfigurationElementCollection listenerElements) { TraceListenerFactory.rwLock.AcquireWriterLock(TraceListenerFactory.DefaultLockTimeout); try { List <FormattedTraceListenerBase> listeners = new List <FormattedTraceListenerBase>(); if (listenerElements != null) { foreach (LoggerListenerConfigurationElement listenerelement in listenerElements) { FormattedTraceListenerBase listener = GetListenerFromConfig(listenerelement); if (listener != null) { listeners.Add(listener); } } } return(listeners); } catch (Exception ex) { throw new LogException("创建Listeners时发生错误:" + ex.Message, ex); } finally { TraceListenerFactory.rwLock.ReleaseWriterLock(); } }
public static List<FormattedTraceListenerBase> GetListeners(LoggerListenerConfigurationElementCollection listenerElements) { TraceListenerFactory.rwLock.AcquireWriterLock(TraceListenerFactory.DefaultLockTimeout); try { List<FormattedTraceListenerBase> listeners = new List<FormattedTraceListenerBase>(); if (listenerElements != null) { foreach (LoggerListenerConfigurationElement listenerelement in listenerElements) { FormattedTraceListenerBase listener = GetListenerFromConfig(listenerelement); if (listener != null) listeners.Add(listener); } } return listeners; } catch (Exception ex) { throw new LogException("创建Listeners时发生错误:" + ex.Message, ex); } finally { TraceListenerFactory.rwLock.ReleaseWriterLock(); } }