Example #1
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 log4net.Util.AppenderAttachedImpl();
                }
                m_appenderAttachedImpl.AddAppender(newAppender);
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
        }
Example #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 log4net.Util.AppenderAttachedImpl();
				}
				m_appenderAttachedImpl.AddAppender(newAppender);
			}
			finally
			{
				m_appenderLock.ReleaseWriterLock();
			}
		}
		/// <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 log4net.Util.AppenderAttachedImpl();
				}
				m_appenderAttachedImpl.AddAppender(newAppender);
			}
		}
Example #4
0
 /// <summary>
 /// Remove all previously added appenders from this Logger instance.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Remove all previously added appenders from this Logger instance.
 /// </para>
 /// <para>
 /// This is useful when re-reading configuration information.
 /// </para>
 /// </remarks>
 public virtual void RemoveAllAppenders()
 {
     m_appenderLock.AcquireWriterLock();
     try
     {
         if (m_appenderAttachedImpl != null)
         {
             m_appenderAttachedImpl.RemoveAllAppenders();
             m_appenderAttachedImpl = null;
         }
     }
     finally
     {
         m_appenderLock.ReleaseWriterLock();
     }
 }
 /// <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>
 public virtual void AddAppender(IAppender newAppender)
 {
     if (newAppender == null)
         throw new ArgumentNullException("newAppender");
     lock (this)
     {
         if (m_appenderAttachedImpl == null)
             m_appenderAttachedImpl = new AppenderAttachedImpl();
         m_appenderAttachedImpl.AddAppender(newAppender);
     }
 }
 /// <summary>
 /// Removes all previously added appenders from this appender.
 /// </summary>
 /// <remarks>
 /// <para>
 /// This is useful when re-reading configuration information.
 /// </para>
 /// </remarks>
 public void RemoveAllAppenders()
 {
     lock (_appenderSynchro)
         if (_appenderAttachedImpl != null)
         {
             _appenderAttachedImpl.RemoveAllAppenders();
             _appenderAttachedImpl = null;
         }
 }
 /// <summary>
 /// Adds an <see cref="IAppender" /> to the list of appenders of this
 /// instance.
 /// </summary>
 /// <param name="appender">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>
 public void AddAppender(IAppender appender)
 {
     if (appender == null)
         throw new ArgumentNullException("appender");
     if (appender is QyfAsyncAppender)
         LogLog.Error(
             string.Format(CultureInfo.InvariantCulture,
                           "It is a design error to have an asyncappender referenced in an asyncappender. Check {0} and {1} relations",
                           Name,
                           appender.Name));
     lock (_appenderSynchro)
     {
         if (_appenderAttachedImpl == null)
             _appenderAttachedImpl = new AppenderAttachedImpl();
         _appenderAttachedImpl.AddAppender(appender);
     }
 }
 /// <summary>
 /// Removes all previously added appenders from this appender.
 /// </summary>
 /// <remarks>
 /// <para>
 /// This is useful when re-reading configuration information.
 /// </para>
 /// </remarks>
 public virtual void RemoveAllAppenders()
 {
     lock (this)
     {
         if (m_appenderAttachedImpl != null)
         {
             m_appenderAttachedImpl.RemoveAllAppenders();
             m_appenderAttachedImpl = null;
         }
     }
 }