/trunk/SSATool.Common.Logging/Logger.cs
C# | 1040 lines | 196 code | 59 blank | 785 comment | 0 complexity | 672bd9d46d55efa61ad46f27bce37cc8 MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- #region Header
- // ------------------------ Licence / Copyright ------------------------
- //
- // Simple Service Administration Tool for WinNT based systems.
- // Copyright © 2010 - Silvan Gehrig
- //
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Lesser General Public
- // License as published by the Free Software Foundation; either
- // version 2.1 of the License, or (at your option) any later version.
- //
- // This library is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- // Lesser General Public License for more details.
- //
- // You should have received a copy of the GNU Lesser General Public
- // License along with this library; if not, write to the Free Software
- // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- //
- // Author:
- // Silvan Gehrig
- //
- // ---------------------------------------------------------------------
- #endregion
-
- #region Usings
-
- using System;
- using log4net;
-
- #endregion
-
- namespace SSATool.Common.Logging
- {
- /// <summary>
- /// Contains the global utilities for the logging purposes.
- /// </summary>
- /// <remarks>
- /// The implementation of the current class follows the borg
- /// "pattern".
- /// </remarks>
- /// <typeparam name="T">Specifies the logging category.</typeparam>
- public class Logger<T>
- {
- #region Declarations
- //--------------------------------------------------------------------
- // Declarations
- //--------------------------------------------------------------------
-
- private static readonly ILog Log = LogManager.GetLogger(typeof (T));
-
- #endregion
-
- #region Constructors / Destructor
- //--------------------------------------------------------------------
- // Constructors / Destructor
- //--------------------------------------------------------------------
-
- /// <summary>
- /// Do not create public instances of the typed logger class.
- /// </summary>
- protected Logger()
- {
-
- }
-
- #endregion
-
- #region Properties
- //--------------------------------------------------------------------
- // Properties
- //--------------------------------------------------------------------
-
- /// <summary>
- /// Nested Diagnostic Context (NDC) uses a stack per thread to identify different clients. It is the developer's responsibility to put
- /// in a unique value for each client. To constrain NDC into a certain block of code, the developer can use
- /// the "using" statement to make his task easier, because it automatically pops the respective value from the stack.
- /// </summary>
- /// <param name="putValue">Specifies the Nested Diagnostic Context (NDC) value to identify different clients.</param>
- public static IDisposable StartNdc(string putValue)
- {
- return NDC.Push(putValue);
- }
-
- /// <summary>
- /// Checks if this logger is enabled for the <see cref="F:log4net.Core.Level.Debug"/> level.
- /// </summary>
- /// <value>
- /// <c>true</c> if this logger is enabled for <see cref="F:log4net.Core.Level.Debug"/> events, <c>false</c> otherwise.
- /// </value>
- /// <remarks>
- /// <para>
- /// This function is intended to lessen the computational cost of
- /// disabled log debug statements.
- /// </para>
- /// <para>
- /// For some ILog interface <c>log</c>, when you write:
- /// </para>
- /// <code lang="C#">
- /// log.Debug("This is entry number: " + i );
- /// </code>
- /// <para>
- /// You incur the cost constructing the message, string construction and concatenation in
- /// this case, regardless of whether the message is logged or not.
- /// </para>
- /// <para>
- /// If you are worried about speed (who isn't), then you should write:
- /// </para>
- /// <code lang="C#">
- /// if (log.IsDebugEnabled)
- /// {
- /// log.Debug("This is entry number: " + i );
- /// }
- /// </code>
- /// <para>
- /// This way you will not incur the cost of parameter
- /// construction if debugging is disabled for <c>log</c>. On
- /// the other hand, if the <c>log</c> is debug enabled, you
- /// will incur the cost of evaluating whether the logger is debug
- /// enabled twice. Once in <see cref="P:log4net.ILog.IsDebugEnabled"/> and once in
- /// the <see cref="M:log4net.ILog.Debug(System.Object)"/>. This is an insignificant overhead
- /// since evaluating a logger takes about 1% of the time it
- /// takes to actually log. This is the preferred style of logging.
- /// </para>
- /// <para>
- /// Alternatively if your logger is available statically then the is debug
- /// enabled state can be stored in a static variable like this:
- /// </para>
- /// <code lang="C#">
- /// private static readonly bool isDebugEnabled = log.IsDebugEnabled;
- /// </code>
- /// <para>
- /// Then when you come to log you can write:
- /// </para>
- /// <code lang="C#">
- /// if (isDebugEnabled)
- /// {
- /// log.Debug("This is entry number: " + i );
- /// }
- /// </code>
- /// <para>
- /// This way the debug enabled state is only queried once
- /// when the class is loaded. Using a <c>private static readonly</c>
- /// variable is the most efficient because it is a run time constant
- /// and can be heavily optimized by the JIT compiler.
- /// </para>
- /// <para>
- /// Of course if you use a static readonly variable to
- /// hold the enabled state of the logger then you cannot
- /// change the enabled state at runtime to vary the logging
- /// that is produced. You have to decide if you need absolute
- /// speed or runtime flexibility.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="M:log4net.ILog.DebugFormat(System.IFormatProvider,System.String,System.Object[])"/>
- public static bool IsDebugEnabled
- {
- get { return Log.IsDebugEnabled; }
- }
-
- /// <summary>
- /// Checks if this logger is enabled for the <see cref="F:log4net.Core.Level.Info"/> level.
- /// </summary>
- /// <value>
- /// <c>true</c> if this logger is enabled for <see cref="F:log4net.Core.Level.Info"/> events, <c>false</c> otherwise.
- /// </value>
- /// <remarks>
- /// For more information see <see cref="P:log4net.ILog.IsDebugEnabled"/>.
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object)"/><seealso cref="M:log4net.ILog.InfoFormat(System.IFormatProvider,System.String,System.Object[])"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static bool IsInfoEnabled
- {
- get { return Log.IsInfoEnabled; }
- }
-
- /// <summary>
- /// Checks if this logger is enabled for the <see cref="F:log4net.Core.Level.Warn"/> level.
- /// </summary>
- /// <value>
- /// <c>true</c> if this logger is enabled for <see cref="F:log4net.Core.Level.Warn"/> events, <c>false</c> otherwise.
- /// </value>
- /// <remarks>
- /// For more information see <see cref="P:log4net.ILog.IsDebugEnabled"/>.
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object)"/><seealso cref="M:log4net.ILog.WarnFormat(System.IFormatProvider,System.String,System.Object[])"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static bool IsWarnEnabled
- {
- get { return Log.IsWarnEnabled; }
- }
-
- /// <summary>
- /// Checks if this logger is enabled for the <see cref="F:log4net.Core.Level.Error"/> level.
- /// </summary>
- /// <value>
- /// <c>true</c> if this logger is enabled for <see cref="F:log4net.Core.Level.Error"/> events, <c>false</c> otherwise.
- /// </value>
- /// <remarks>
- /// For more information see <see cref="P:log4net.ILog.IsDebugEnabled"/>.
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object)"/><seealso cref="M:log4net.ILog.ErrorFormat(System.IFormatProvider,System.String,System.Object[])"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static bool IsErrorEnabled
- {
- get { return Log.IsErrorEnabled; }
- }
-
- /// <summary>
- /// Checks if this logger is enabled for the <see cref="F:log4net.Core.Level.Fatal"/> level.
- /// </summary>
- /// <value>
- /// <c>true</c> if this logger is enabled for <see cref="F:log4net.Core.Level.Fatal"/> events, <c>false</c> otherwise.
- /// </value>
- /// <remarks>
- /// For more information see <see cref="P:log4net.ILog.IsDebugEnabled"/>.
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Fatal(System.Object)"/><seealso cref="M:log4net.ILog.FatalFormat(System.IFormatProvider,System.String,System.Object[])"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static bool IsFatalEnabled
- {
- get { return Log.IsFatalEnabled; }
- }
-
- #endregion
-
- #region Methods
- //--------------------------------------------------------------------
- // Methods
- //--------------------------------------------------------------------
-
- /// <overloads>Log a message object with the <see cref="F:log4net.Core.Level.Debug"/> level.</overloads>
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Debug"/> level.
- /// </summary>
- /// <param name="message">The message object to log.</param>
- /// <remarks>
- /// <para>
- /// This method first checks if this logger is <c>DEBUG</c>
- /// enabled by comparing the level of this logger with the
- /// <see cref="F:log4net.Core.Level.Debug"/> level. If this logger is
- /// <c>DEBUG</c> enabled, then it converts the message object
- /// (passed as parameter) to a string by invoking the appropriate
- /// <see cref="T: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="T:System.Exception"/>
- /// to this method will print the name of the <see cref="T:System.Exception"/>
- /// but no stack trace. To print a stack trace use the
- /// <see cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/> form instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void Debug(object message)
- {
- Log.Debug(message);
- }
-
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Debug"/> level including
- /// the stack trace of the <see cref="T:System.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:log4net.ILog.Debug(System.Object)"/> form for more detailed information.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void Debug(object message, Exception exception)
- {
- Log.Debug(message, exception);
- }
-
- /// <overloads>Log a formatted string with the <see cref="F:log4net.Core.Level.Debug"/> level.</overloads>
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Debug"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void DebugFormat(string format, params object[] args)
- {
- Log.DebugFormat(format, args);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Debug"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void DebugFormat(string format, object arg0)
- {
- Log.DebugFormat(format, arg0);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Debug"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void DebugFormat(string format, object arg0, object arg1)
- {
- Log.DebugFormat(format, arg0, arg1);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Debug"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void DebugFormat(string format, object arg0, object arg1, object arg2)
- {
- Log.DebugFormat(format, arg0, arg1, arg2);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Debug"/> level.
- /// </summary>
- /// <param name="provider">An <see cref="T:System.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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Debug(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Debug(System.Object)"/><seealso cref="P:log4net.ILog.IsDebugEnabled"/>
- public static void DebugFormat(IFormatProvider provider, string format, params object[] args)
- {
- Log.DebugFormat(provider, format, args);
- }
-
- /// <overloads>Log a message object with the <see cref="F:log4net.Core.Level.Info"/> level.</overloads>
- /// <summary>
- /// Logs a message object with the <see cref="F:log4net.Core.Level.Info"/> level.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This method first checks if this logger is <c>INFO</c>
- /// enabled by comparing the level of this logger with the
- /// <see cref="F:log4net.Core.Level.Info"/> level. If this logger is
- /// <c>INFO</c> enabled, then it converts the message object
- /// (passed as parameter) to a string by invoking the appropriate
- /// <see cref="T: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="T:System.Exception"/>
- /// to this method will print the name of the <see cref="T:System.Exception"/>
- /// but no stack trace. To print a stack trace use the
- /// <see cref="M:log4net.ILog.Info(System.Object,System.Exception)"/> form instead.
- /// </para>
- /// </remarks>
- /// <param name="message">The message object to log.</param><seealso cref="M:log4net.ILog.Info(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void Info(object message)
- {
- Log.Info(message);
- }
-
- /// <summary>
- /// Logs a message object with the <c>INFO</c> level including
- /// the stack trace of the <see cref="T:System.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:log4net.ILog.Info(System.Object)"/> form for more detailed information.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void Info(object message, Exception exception)
- {
- Log.Info(message, exception);
- }
-
- /// <overloads>Log a formatted message string with the <see cref="F:log4net.Core.Level.Info"/> level.</overloads>
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Info"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Info(System.Object)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void InfoFormat(string format, params object[] args)
- {
- Log.InfoFormat(format, args);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Info"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Info(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void InfoFormat(string format, object arg0)
- {
- Log.InfoFormat(format, arg0);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Info"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Info(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void InfoFormat(string format, object arg0, object arg1)
- {
- Log.InfoFormat(format, arg0, arg1);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Info"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Info(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void InfoFormat(string format, object arg0, object arg1, object arg2)
- {
- Log.InfoFormat(format, arg0, arg1, arg2);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Info"/> level.
- /// </summary>
- /// <param name="provider">An <see cref="T:System.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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Info(System.Object)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Info(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsInfoEnabled"/>
- public static void InfoFormat(IFormatProvider provider, string format, params object[] args)
- {
- Log.InfoFormat(provider, format, args);
- }
-
- /// <overloads>Log a message object with the <see cref="F:log4net.Core.Level.Warn"/> level.</overloads>
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Warn"/> level.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This method first checks if this logger is <c>WARN</c>
- /// enabled by comparing the level of this logger with the
- /// <see cref="F:log4net.Core.Level.Warn"/> level. If this logger is
- /// <c>WARN</c> enabled, then it converts the message object
- /// (passed as parameter) to a string by invoking the appropriate
- /// <see cref="T: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="T:System.Exception"/>
- /// to this method will print the name of the <see cref="T:System.Exception"/>
- /// but no stack trace. To print a stack trace use the
- /// <see cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/> form instead.
- /// </para>
- /// </remarks>
- /// <param name="message">The message object to log.</param><seealso cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void Warn(object message)
- {
- Log.Warn(message);
- }
-
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Warn"/> level including
- /// the stack trace of the <see cref="T:System.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:log4net.ILog.Warn(System.Object)"/> form for more detailed information.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void Warn(object message, Exception exception)
- {
- Log.Warn(message, exception);
- }
-
- /// <overloads>Log a formatted message string with the <see cref="F:log4net.Core.Level.Warn"/> level.</overloads>
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Warn"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Warn(System.Object)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void WarnFormat(string format, params object[] args)
- {
- Log.WarnFormat(format, args);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Warn"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void WarnFormat(string format, object arg0)
- {
- Log.WarnFormat(format, arg0);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Warn"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void WarnFormat(string format, object arg0, object arg1)
- {
- Log.WarnFormat(format, arg0, arg1);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Warn"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void WarnFormat(string format, object arg0, object arg1, object arg2)
- {
- Log.WarnFormat(format, arg0, arg1, arg2);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Warn"/> level.
- /// </summary>
- /// <param name="provider">An <see cref="T:System.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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Warn(System.Object)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Warn(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsWarnEnabled"/>
- public static void WarnFormat(IFormatProvider provider, string format, params object[] args)
- {
- Log.WarnFormat(provider, format, args);
- }
-
- /// <overloads>Log a message object with the <see cref="F:log4net.Core.Level.Error"/> level.</overloads>
- /// <summary>
- /// Logs a message object with the <see cref="F:log4net.Core.Level.Error"/> level.
- /// </summary>
- /// <param name="message">The message object to log.</param>
- /// <remarks>
- /// <para>
- /// This method first checks if this logger is <c>ERROR</c>
- /// enabled by comparing the level of this logger with the
- /// <see cref="F:log4net.Core.Level.Error"/> level. If this logger is
- /// <c>ERROR</c> enabled, then it converts the message object
- /// (passed as parameter) to a string by invoking the appropriate
- /// <see cref="T: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="T:System.Exception"/>
- /// to this method will print the name of the <see cref="T:System.Exception"/>
- /// but no stack trace. To print a stack trace use the
- /// <see cref="M:log4net.ILog.Error(System.Object,System.Exception)"/> form instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void Error(object message)
- {
- Log.Error(message);
- }
-
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Error"/> level including
- /// the stack trace of the <see cref="T:System.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:log4net.ILog.Error(System.Object)"/> form for more detailed information.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void Error(object message, Exception exception)
- {
- Log.Error(message, exception);
- }
-
- /// <overloads>Log a formatted message string with the <see cref="F:log4net.Core.Level.Error"/> level.</overloads>
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Error"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Error(System.Object)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void ErrorFormat(string format, params object[] args)
- {
- Log.ErrorFormat(format, args);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Error"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Error(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void ErrorFormat(string format, object arg0)
- {
- Log.ErrorFormat(format, arg0);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Error"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Error(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void ErrorFormat(string format, object arg0, object arg1)
- {
- Log.ErrorFormat(format, arg0, arg1);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Error"/> 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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Error(System.Object,System.Exception)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void ErrorFormat(string format, object arg0, object arg1, object arg2)
- {
- Log.ErrorFormat(format, arg0, arg1, arg2);
- }
-
- /// <summary>
- /// Logs a formatted message string with the <see cref="F:log4net.Core.Level.Error"/> level.
- /// </summary>
- /// <param name="provider">An <see cref="T:System.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:System.String.Format(System.String,System.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="T:System.Exception"/> object to include in the
- /// log event. To pass an <see cref="T:System.Exception"/> use one of the <see cref="M:log4net.ILog.Error(System.Object)"/>
- /// methods instead.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:log4net.ILog.Error(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsErrorEnabled"/>
- public static void ErrorFormat(IFormatProvider provider, string format, params object[] args)
- {
- Log.ErrorFormat(provider, format, args);
- }
-
- /// <overloads>Log a message object with the <see cref="F:log4net.Core.Level.Fatal"/> level.</overloads>
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Fatal"/> level.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This method first checks if this logger is <c>FATAL</c>
- /// enabled by comparing the level of this logger with the
- /// <see cref="F:log4net.Core.Level.Fatal"/> level. If this logger is
- /// <c>FATAL</c> enabled, then it converts the message object
- /// (passed as parameter) to a string by invoking the appropriate
- /// <see cref="T: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="T:System.Exception"/>
- /// to this method will print the name of the <see cref="T:System.Exception"/>
- /// but no stack trace. To print a stack trace use the
- /// <see cref="M:log4net.ILog.Fatal(System.Object,System.Exception)"/> form instead.
- /// </para>
- /// </remarks>
- /// <param name="message">The message object to log.</param><seealso cref="M:log4net.ILog.Fatal(System.Object,System.Exception)"/><seealso cref="P:log4net.ILog.IsFatalEnabled"/>
- public static void Fatal(object message)
- {
- Log.Fatal(message);
- }
-
- /// <summary>
- /// Log a message object with the <see cref="F:log4net.Core.Level.Fatal"/> level including
- /// the stack trace of the <see cref="T:System.Exception"/> passed
- /// as a parameter.
- /// </…
Large files files are truncated, but you can click here to view the full file