You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by bo...@apache.org on 2013/11/22 22:02:13 UTC

svn commit: r1544675 - in /logging/log4net/trunk: extensions/net/1.0/log4net.Ext.Trace/ src/log4net/Core/LogImpl.cs src/log4net/ILog.cs src/log4net/Util/ILogExtensions.cs

Author: bodewig
Date: Fri Nov 22 21:02:12 2013
New Revision: 1544675

URL: http://svn.apache.org/r1544675
Log:
LOG4NET-187 add Trace to ILog

Removed:
    logging/log4net/trunk/extensions/net/1.0/log4net.Ext.Trace/
Modified:
    logging/log4net/trunk/src/log4net/Core/LogImpl.cs
    logging/log4net/trunk/src/log4net/ILog.cs
    logging/log4net/trunk/src/log4net/Util/ILogExtensions.cs

Modified: logging/log4net/trunk/src/log4net/Core/LogImpl.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Core/LogImpl.cs?rev=1544675&r1=1544674&r2=1544675&view=diff
==============================================================================
--- logging/log4net/trunk/src/log4net/Core/LogImpl.cs (original)
+++ logging/log4net/trunk/src/log4net/Core/LogImpl.cs Fri Nov 22 21:02:12 2013
@@ -39,6 +39,16 @@ namespace log4net.Core
 	/// </para>
 	/// <list type="definition">
 	///   <item>
+	///     <term>TRACE</term>
+	///     <description>
+	///     The <see cref="M:Trace(object)"/> and <see cref="M:TraceFormat(string, object[])"/> methods log messages
+	///     at the <c>TRACE</c> level. That is the level with that name defined in the
+	///     repositories <see cref="ILoggerRepository.LevelMap"/>. The default value
+	///     for this level is <see cref="Level.Trace"/>. The <see cref="IsTraceEnabled"/>
+	///     property tests if this level is enabled for logging.
+	///     </description>
+	///   </item>
+	///   <item>
 	///     <term>DEBUG</term>
 	///     <description>
 	///     The <see cref="M:Debug(object)"/> and <see cref="M:DebugFormat(string, object[])"/> methods log messages
@@ -133,6 +143,7 @@ namespace log4net.Core
 		{
 			LevelMap levelMap = repository.LevelMap;
 
+			m_levelTrace = levelMap.LookupWithDefault(Level.Trace);
 			m_levelDebug = levelMap.LookupWithDefault(Level.Debug);
 			m_levelInfo = levelMap.LookupWithDefault(Level.Info);
 			m_levelWarn = levelMap.LookupWithDefault(Level.Warn);
@@ -143,6 +154,204 @@ namespace log4net.Core
 		#region Implementation of ILog
 
 		/// <summary>
+		/// Logs a message object with the <c>TRACE</c> level.
+		/// </summary>
+		/// <param name="message">The message object to log.</param>
+		/// <remarks>
+		/// <para>
+		/// This method first checks if this logger is <c>TRACE</c>
+		/// enabled by comparing the level of this logger with the 
+		/// <c>TRACE</c> level. If this logger is
+		/// <c>TRACE</c> enabled, then it converts the message object
+		/// (passed as parameter) to a string by invoking the appropriate
+		/// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 
+		/// proceeds to call all the registered appenders in this logger and 
+		/// also higher in the hierarchy depending on the value of the 
+		/// additivity flag.
+		/// </para>
+		/// <para>
+		/// <b>WARNING</b> Note that passing an <see cref="Exception"/> to this
+		/// method will print the name of the <see cref="Exception"/> but no
+		/// stack trace. To print a stack trace use the 
+		/// <see cref="M:Trace(object,Exception)"/> form instead.
+		/// </para>
+		/// </remarks>
+		virtual public void Trace(object message) 
+		{
+			Logger.Log(ThisDeclaringType, m_levelTrace, message, null);
+		}
+  
+		/// <summary>
+		/// Logs a message object with the <c>TRACE</c> level
+		/// </summary>
+		/// <param name="message">The message object to log.</param>
+		/// <param name="exception">The exception to log, including its stack trace.</param>
+		/// <remarks>
+		/// <para>
+		/// Logs a message object with the <c>TRACE</c> level including
+		/// the stack trace of the <see cref="Exception"/> <paramref name="exception"/> 
+		/// passed as a parameter.
+		/// </para>
+		/// <para>
+		/// See the <see cref="M:Trace(object)"/> form for more detailed information.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object)"/>
+		virtual public void Trace(object message, Exception exception) 
+		{
+			Logger.Log(ThisDeclaringType, m_levelTrace, message, exception);
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <c>TRACE</c> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="args">An Object array containing zero or more objects to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <see cref="M:String.Format(IFormatProvider, string, object[])"/> method. See
+		/// <c>String.Format</c> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// The string is formatted using the <see cref="CultureInfo.InvariantCulture"/>
+		/// format provider. To specify a localized provider use the
+		/// <see cref="M:TraceFormat(IFormatProvider,string,object[])"/> method.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		virtual public void TraceFormat(string format, params object[] args) 
+		{
+			if (IsTraceEnabled)
+			{
+				Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), null);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <c>TRACE</c> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <see cref="M:String.Format(IFormatProvider, string, object[])"/> method. See
+		/// <c>String.Format</c> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// The string is formatted using the <see cref="CultureInfo.InvariantCulture"/>
+		/// format provider. To specify a localized provider use the
+		/// <see cref="M:TraceFormat(IFormatProvider,string,object[])"/> method.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		virtual public void TraceFormat(string format, object arg0) 
+		{
+			if (IsTraceEnabled)
+			{
+				Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <c>TRACE</c> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <param name="arg1">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <see cref="M:String.Format(IFormatProvider, string, object[])"/> method. See
+		/// <c>String.Format</c> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// The string is formatted using the <see cref="CultureInfo.InvariantCulture"/>
+		/// format provider. To specify a localized provider use the
+		/// <see cref="M:TraceFormat(IFormatProvider,string,object[])"/> method.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		virtual public void TraceFormat(string format, object arg0, object arg1) 
+		{
+			if (IsTraceEnabled)
+			{
+				Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <c>TRACE</c> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <param name="arg1">An Object to format</param>
+		/// <param name="arg2">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <see cref="M:String.Format(IFormatProvider, string, object[])"/> method. See
+		/// <c>String.Format</c> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// The string is formatted using the <see cref="CultureInfo.InvariantCulture"/>
+		/// format provider. To specify a localized provider use the
+		/// <see cref="M:TraceFormat(IFormatProvider,string,object[])"/> method.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		virtual public void TraceFormat(string format, object arg0, object arg1, object arg2) 
+		{
+			if (IsTraceEnabled)
+			{
+				Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <c>TRACE</c> level.
+		/// </summary>
+		/// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="args">An Object array containing zero or more objects to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <see cref="M:String.Format(IFormatProvider, string, object[])"/> method. See
+		/// <c>String.Format</c> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		virtual public void TraceFormat(IFormatProvider provider, string format, params object[] args) 
+		{
+			if (IsTraceEnabled)
+			{
+				Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(provider, format, args), null);
+			}
+		}
+
+		/// <summary>
 		/// Logs a message object with the <c>DEBUG</c> level.
 		/// </summary>
 		/// <param name="message">The message object to log.</param>
@@ -1133,6 +1342,25 @@ namespace log4net.Core
 		}
 
 		/// <summary>
+		/// Checks if this logger is enabled for the <c>TRACE</c> level.
+		/// </summary>
+		/// <value>
+		/// <c>true</c> if this logger is enabled for <c>TRACE</c> events,
+		/// <c>false</c> otherwise.
+		/// </value>
+		/// <remarks>
+		/// <para>
+		/// See <see cref="IsDebugEnabled"/> for more tracermation and examples 
+		/// of using this method.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="LogImpl.IsDebugEnabled"/>
+		virtual public bool IsTraceEnabled
+		{
+			get { return Logger.IsEnabledFor(m_levelTrace); }
+		}
+
+		/// <summary>
 		/// Checks if this logger is enabled for the <c>DEBUG</c>
 		/// level.
 		/// </summary>
@@ -1285,6 +1513,7 @@ namespace log4net.Core
 
 		#region Private Fields
 
+		private Level m_levelTrace;
 		private Level m_levelDebug;
 		private Level m_levelInfo;
 		private Level m_levelWarn;

Modified: logging/log4net/trunk/src/log4net/ILog.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/ILog.cs?rev=1544675&r1=1544674&r2=1544675&view=diff
==============================================================================
--- logging/log4net/trunk/src/log4net/ILog.cs (original)
+++ logging/log4net/trunk/src/log4net/ILog.cs Fri Nov 22 21:02:12 2013
@@ -65,6 +65,159 @@ namespace log4net
 	/// <author>Gert Driesen</author>
 	public interface ILog : ILoggerWrapper
 	{
+		/// <overloads>Log a message object with the <see cref="Level.Trace"/> level.</overloads>
+		/// <summary>
+		/// Log a message object with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <remarks>
+		/// <para>
+		/// This method first checks if this logger is <c>TRACE</c>
+		/// enabled by comparing the level of this logger with the 
+		/// <see cref="Level.Trace"/> level. If this logger is
+		/// <c>TRACE</c> enabled, then it converts the message object
+		/// (passed as parameter) to a string by invoking the appropriate
+		/// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 
+		/// proceeds to call all the registered appenders in this logger 
+		/// and also higher in the hierarchy depending on the value of the 
+		/// additivity flag.
+		/// </para>
+		/// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 
+		/// to this method will print the name of the <see cref="Exception"/> 
+		/// but no stack trace. To print a stack trace use the 
+		/// <see cref="M:Trace(object,Exception)"/> form instead.
+		/// </para>
+		/// </remarks>
+		/// <param name="message">The message object to log.</param>
+		/// <seealso cref="M:Trace(object,Exception)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void Trace(object message);
+  
+		/// <summary>
+		/// Log a message object with the <see cref="Level.Trace"/> level including
+		/// the stack trace of the <see cref="Exception"/> passed
+		/// as a parameter.
+		/// </summary>
+		/// <param name="message">The message object to log.</param>
+		/// <param name="exception">The exception to log, including its stack trace.</param>
+		/// <remarks>
+		/// <para>
+		/// See the <see cref="M:Trace(object)"/> form for more detailed information.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void Trace(object message, Exception exception);
+
+		/// <overloads>Log a formatted message string with the <see cref="Level.Trace"/> level.</overloads>
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="args">An Object array containing zero or more objects to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="M:String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object,Exception)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void TraceFormat(string format, params object[] args);
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="M:String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void TraceFormat(string format, object arg0); 
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <param name="arg1">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="M:String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void TraceFormat(string format, object arg0, object arg1); 
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <param name="arg1">An Object to format</param>
+		/// <param name="arg2">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="M:String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void TraceFormat(string format, object arg0, object arg1, object arg2); 
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="args">An Object array containing zero or more objects to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="M:String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="M:Trace(object)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="M:Trace(object,Exception)"/>
+		/// <seealso cref="IsTraceEnabled"/>
+		void TraceFormat(IFormatProvider provider, string format, params object[] args);
+
 		/// <overloads>Log a message object with the <see cref="Level.Debug"/> level.</overloads>
 		/// <summary>
 		/// Log a message object with the <see cref="Level.Debug"/> level.
@@ -902,6 +1055,20 @@ namespace log4net
 		bool IsDebugEnabled { get; }
   
 		/// <summary>
+		/// Checks if this logger is enabled for the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <value>
+		/// <c>true</c> if this logger is enabled for <see cref="Level.Trace"/> events, <c>false</c> otherwise.
+		/// </value>
+		/// <remarks>
+		/// For more information see <see cref="ILog.IsDebugEnabled"/>.
+		/// </remarks>
+		/// <seealso cref="M:Trace(object)"/>
+		/// <seealso cref="M:TraceFormat(IFormatProvider, string, object[])"/>
+		/// <seealso cref="ILog.IsDebugEnabled"/>
+		bool IsTraceEnabled { get; }
+
+		/// <summary>
 		/// Checks if this logger is enabled for the <see cref="Level.Info"/> level.
 		/// </summary>
 		/// <value>
@@ -956,5 +1123,6 @@ namespace log4net
 		/// <seealso cref="M:FatalFormat(IFormatProvider, string, object[])"/>
 		/// <seealso cref="ILog.IsDebugEnabled"/>
 		bool IsFatalEnabled { get; }
+
 	}
 }

Modified: logging/log4net/trunk/src/log4net/Util/ILogExtensions.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Util/ILogExtensions.cs?rev=1544675&r1=1544674&r2=1544675&view=diff
==============================================================================
--- logging/log4net/trunk/src/log4net/Util/ILogExtensions.cs (original)
+++ logging/log4net/trunk/src/log4net/Util/ILogExtensions.cs Fri Nov 22 21:02:12 2013
@@ -57,6 +57,342 @@ namespace log4net.Util
 
 		#endregion //Private Static Fields
 
+		#region trace extensions
+
+		#region trace extensions that uses log message lambda expression
+
+		/// <summary>
+		/// Log a message object with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="callback">The lambda expression that gets the object to log.</param>
+		/// <remarks>
+		/// <para>
+		/// This method first checks if this logger is <c>TRACE</c>
+		/// enabled by reading the value <seealso cref="ILog.IsTraceEnabled"/> property.
+		/// This check happens always and does not depend on the <seealso cref="ILog"/>
+		/// implementation.  If this logger is <c>TRACE</c> enabled, then it converts 
+		/// the message object (retrieved by invocation of the provided callback) to a 
+		/// string by invoking the appropriate <see cref="log4net.ObjectRenderer.IObjectRenderer"/>.
+		/// It then proceeds to call all the registered appenders in this logger 
+		/// and also higher in the hierarchy depending on the value of 
+		/// the additivity flag.
+		/// </para>
+		/// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 
+		/// to this method will print the name of the <see cref="Exception"/> 
+		/// but no stack trace. To print a stack trace use the 
+		/// <see cref="TraceExt(ILog,Func{object},Exception)"/> form instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceExt(this ILog logger, Func<object> callback)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.Trace(callback());
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		/// <summary>
+		/// Log a message object with the <see cref="Level.Trace"/> level including
+		/// the stack trace of the <see cref="Exception"/> passed
+		/// as a parameter.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="callback">The lambda expression that gets the object to log.</param>
+		/// <param name="exception">The exception to log, including its stack trace.</param>
+		/// <remarks>
+		/// <para>
+		/// See the <see cref="TraceExt(ILog, object)"/> form for more detailed information.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceExt(this ILog logger, Func<object> callback, Exception exception)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.Trace(callback(), exception);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		#endregion
+
+		#region trace extension that use the formatter
+
+		/// <overloads>Log a message object with the <see cref="Level.Trace"/> level.</overloads> //TODO
+		/// <summary>
+		/// Log a message object with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="message">The message object to log.</param>
+		/// <remarks>
+		/// <para>
+		/// This method first checks if this logger is <c>TRACE</c>
+		/// enabled by reading the value <seealso cref="ILog.IsTraceEnabled"/> property.
+		/// This check happens always and does not depend on the <seealso cref="ILog"/>
+		/// implementation. If this logger is <c>TRACE</c> enabled, then it converts 
+		/// the message object (passed as parameter) to a string by invoking the appropriate
+		/// <see cref="log4net.ObjectRenderer.IObjectRenderer"/>. It then 
+		/// proceeds to call all the registered appenders in this logger 
+		/// and also higher in the hierarchy depending on the value of 
+		/// the additivity flag.
+		/// </para>
+		/// <para><b>WARNING</b> Note that passing an <see cref="Exception"/> 
+		/// to this method will print the name of the <see cref="Exception"/> 
+		/// but no stack trace. To print a stack trace use the 
+		/// <see cref="TraceExt(ILog,object,Exception)"/> form instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceExt(this ILog logger, object message)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.Trace(message);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		/// <summary>
+		/// Log a message object with the <see cref="Level.Trace"/> level including
+		/// the stack trace of the <see cref="Exception"/> passed
+		/// as a parameter.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="message">The message object to log.</param>
+		/// <param name="exception">The exception to log, including its stack trace.</param>
+		/// <remarks>
+		/// <para>
+		/// See the <see cref="TraceExt(ILog, object)"/> form for more detailed information.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceExt(this ILog logger, object message, Exception exception)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.Trace(message, exception);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		#endregion
+
+		#region trace extension that use string format
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="TraceExt(ILog,object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceFormatExt(this ILog logger, string format, object arg0)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.TraceFormat(format, arg0);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="args">An Object array containing zero or more objects to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="TraceExt(ILog,object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceFormatExt(this ILog logger, string format, params object[] args)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.TraceFormat(format, args);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="provider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information</param>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="args">An Object array containing zero or more objects to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="TraceExt(ILog,object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceFormatExt(this ILog logger, IFormatProvider provider, string format, params object[] args)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.TraceFormat(provider, format, args);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <param name="arg1">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="TraceExt(ILog,object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceFormatExt(this ILog logger, string format, object arg0, object arg1)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.TraceFormat(format, arg0, arg1);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		/// <summary>
+		/// Logs a formatted message string with the <see cref="Level.Trace"/> level.
+		/// </summary>
+		/// <param name="logger">The logger on which the message is logged.</param>
+		/// <param name="format">A String containing zero or more format items</param>
+		/// <param name="arg0">An Object to format</param>
+		/// <param name="arg1">An Object to format</param>
+		/// <param name="arg2">An Object to format</param>
+		/// <remarks>
+		/// <para>
+		/// The message is formatted using the <c>String.Format</c> method. See
+		/// <see cref="String.Format(string, object[])"/> for details of the syntax of the format string and the behavior
+		/// of the formatting.
+		/// </para>
+		/// <para>
+		/// This method does not take an <see cref="Exception"/> object to include in the
+		/// log event. To pass an <see cref="Exception"/> use one of the <see cref="TraceExt(ILog,object,Exception)"/>
+		/// methods instead.
+		/// </para>
+		/// </remarks>
+		/// <seealso cref="ILog.Trace(object)"/>
+		/// <seealso cref="ILog.IsTraceEnabled"/>
+		public static void TraceFormatExt(this ILog logger, string format, object arg0, object arg1, object arg2)
+		{
+			try
+			{
+				if (!logger.IsTraceEnabled)
+					return;
+
+				logger.TraceFormat(format, arg0, arg1, arg2);
+			}
+			catch (Exception ex)
+			{
+				log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+			}
+		}
+
+		#endregion
+
+		#endregion
+
 		#region debug extensions
 
 		#region debug extensions that uses log message lambda expression