Exemplo n.º 1
0
 /// <summary>
 /// Adds an <see cref="IAppender" /> to the list of appenders of this
 /// instance.
 /// </summary>
 /// <param name="newAppender">The <see cref="IAppender" /> to add to this appender.</param>
 /// <remarks>
 /// <para>
 /// If the specified <see cref="IAppender" /> is already in the list of
 /// appenders, then it won't be added again.
 /// </para>
 /// </remarks>
 virtual public void AddAppender(IAppender newAppender)
 {
     if (newAppender == null)
     {
         throw new ArgumentNullException("newAppender");
     }
     lock (this)
     {
         if (m_appenderAttachedImpl == null)
         {
             m_appenderAttachedImpl = new zlog4net.Util.AppenderAttachedImpl();
         }
         m_appenderAttachedImpl.AddAppender(newAppender);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Add <paramref name="newAppender"/> to the list of appenders of this
        /// Logger instance.
        /// </summary>
        /// <param name="newAppender">An appender to add to this logger</param>
        /// <remarks>
        /// <para>
        /// Add <paramref name="newAppender"/> to the list of appenders of this
        /// Logger instance.
        /// </para>
        /// <para>
        /// If <paramref name="newAppender"/> is already in the list of
        /// appenders, then it won't be added again.
        /// </para>
        /// </remarks>
        virtual public void AddAppender(IAppender newAppender)
        {
            if (newAppender == null)
            {
                throw new ArgumentNullException("newAppender");
            }

            m_appenderLock.AcquireWriterLock();
            try
            {
                if (m_appenderAttachedImpl == null)
                {
                    m_appenderAttachedImpl = new zlog4net.Util.AppenderAttachedImpl();
                }
                m_appenderAttachedImpl.AddAppender(newAppender);
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
        }