http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/LogLog.cs ---------------------------------------------------------------------- diff --git a/src/Util/LogLog.cs b/src/Util/LogLog.cs index 60ecd14..523aebf 100644 --- a/src/Util/LogLog.cs +++ b/src/Util/LogLog.cs @@ -26,12 +26,12 @@ using System.Diagnostics; namespace log4net.Util { - /// <summary> - /// - /// </summary> - /// <param name="source"></param> - /// <param name="e"></param> - public delegate void LogReceivedEventHandler(object source, LogReceivedEventArgs e); + /// <summary> + /// + /// </summary> + /// <param name="source"></param> + /// <param name="e"></param> + public delegate void LogReceivedEventHandler(object source, LogReceivedEventArgs e); /// <summary> /// Outputs log statements from within the log4net assembly. @@ -52,101 +52,101 @@ namespace log4net.Util /// <author>Gert Driesen</author> public sealed class LogLog { - /// <summary> - /// The event raised when an internal message has been received. - /// </summary> - public static event LogReceivedEventHandler LogReceived; - - private readonly Type source; - private readonly DateTime timeStampUtc; - private readonly string prefix; - private readonly string message; - private readonly Exception exception; - - /// <summary> - /// The Type that generated the internal message. - /// </summary> - public Type Source - { - get { return source; } - } - - /// <summary> - /// The DateTime stamp of when the internal message was received. - /// </summary> - public DateTime TimeStamp - { - get { return timeStampUtc.ToLocalTime(); } - } - - /// <summary> - /// The UTC DateTime stamp of when the internal message was received. - /// </summary> - public DateTime TimeStampUtc - { - get { return timeStampUtc; } - } - - /// <summary> - /// A string indicating the severity of the internal message. - /// </summary> - /// <remarks> - /// "log4net: ", - /// "log4net:ERROR ", - /// "log4net:WARN " - /// </remarks> - public string Prefix - { - get { return prefix; } - } - - /// <summary> - /// The internal log message. - /// </summary> - public string Message - { - get { return message; } - } - - /// <summary> - /// The Exception related to the message. - /// </summary> - /// <remarks> - /// Optional. Will be null if no Exception was passed. - /// </remarks> - public Exception Exception - { - get { return exception; } - } - - /// <summary> - /// Formats Prefix, Source, and Message in the same format as the value - /// sent to Console.Out and Trace.Write. - /// </summary> - /// <returns></returns> - public override string ToString() - { - return Prefix + Source.Name + ": " + Message; - } - - #region Private Instance Constructors - - /// <summary> - /// Initializes a new instance of the <see cref="LogLog" /> class. - /// </summary> - /// <param name="source"></param> - /// <param name="prefix"></param> - /// <param name="message"></param> - /// <param name="exception"></param> - public LogLog(Type source, string prefix, string message, Exception exception) - { - timeStampUtc = DateTime.UtcNow; - - this.source = source; - this.prefix = prefix; - this.message = message; - this.exception = exception; - } + /// <summary> + /// The event raised when an internal message has been received. + /// </summary> + public static event LogReceivedEventHandler LogReceived; + + private readonly Type source; + private readonly DateTime timeStampUtc; + private readonly string prefix; + private readonly string message; + private readonly Exception exception; + + /// <summary> + /// The Type that generated the internal message. + /// </summary> + public Type Source + { + get { return source; } + } + + /// <summary> + /// The DateTime stamp of when the internal message was received. + /// </summary> + public DateTime TimeStamp + { + get { return timeStampUtc.ToLocalTime(); } + } + + /// <summary> + /// The UTC DateTime stamp of when the internal message was received. + /// </summary> + public DateTime TimeStampUtc + { + get { return timeStampUtc; } + } + + /// <summary> + /// A string indicating the severity of the internal message. + /// </summary> + /// <remarks> + /// "log4net: ", + /// "log4net:ERROR ", + /// "log4net:WARN " + /// </remarks> + public string Prefix + { + get { return prefix; } + } + + /// <summary> + /// The internal log message. + /// </summary> + public string Message + { + get { return message; } + } + + /// <summary> + /// The Exception related to the message. + /// </summary> + /// <remarks> + /// Optional. Will be null if no Exception was passed. + /// </remarks> + public Exception Exception + { + get { return exception; } + } + + /// <summary> + /// Formats Prefix, Source, and Message in the same format as the value + /// sent to Console.Out and Trace.Write. + /// </summary> + /// <returns></returns> + public override string ToString() + { + return Prefix + Source.Name + ": " + Message; + } + + #region Private Instance Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="LogLog" /> class. + /// </summary> + /// <param name="source"></param> + /// <param name="prefix"></param> + /// <param name="message"></param> + /// <param name="exception"></param> + public LogLog(Type source, string prefix, string message, Exception exception) + { + timeStampUtc = DateTime.UtcNow; + + this.source = source; + this.prefix = prefix; + this.message = message; + this.exception = exception; + } #endregion Private Instance Constructors @@ -275,35 +275,35 @@ namespace log4net.Util set { s_quietMode = value; } } - /// <summary> - /// - /// </summary> - public static bool EmitInternalMessages - { - get { return s_emitInternalMessages; } - set { s_emitInternalMessages = value; } - } + /// <summary> + /// + /// </summary> + public static bool EmitInternalMessages + { + get { return s_emitInternalMessages; } + set { s_emitInternalMessages = value; } + } #endregion Public Static Properties #region Public Static Methods - /// <summary> - /// Raises the LogReceived event when an internal messages is received. - /// </summary> - /// <param name="source"></param> - /// <param name="prefix"></param> - /// <param name="message"></param> - /// <param name="exception"></param> - public static void OnLogReceived(Type source, string prefix, string message, Exception exception) - { - if (LogReceived != null) - { - LogReceived(null, new LogReceivedEventArgs(new LogLog(source, prefix, message, exception))); - } - } - - /// <summary> + /// <summary> + /// Raises the LogReceived event when an internal messages is received. + /// </summary> + /// <param name="source"></param> + /// <param name="prefix"></param> + /// <param name="message"></param> + /// <param name="exception"></param> + public static void OnLogReceived(Type source, string prefix, string message, Exception exception) + { + if (LogReceived != null) + { + LogReceived(null, new LogReceivedEventArgs(new LogLog(source, prefix, message, exception))); + } + } + + /// <summary> /// Test if LogLog.Debug is enabled for output. /// </summary> /// <value> @@ -323,7 +323,7 @@ namespace log4net.Util /// Writes log4net internal debug messages to the /// standard output stream. /// </summary> - /// <param name="source"></param> + /// <param name="source"></param> /// <param name="message">The message to log.</param> /// <remarks> /// <para> @@ -335,12 +335,12 @@ namespace log4net.Util { if (IsDebugEnabled) { - if (EmitInternalMessages) - { - EmitOutLine(PREFIX + message); - } + if (EmitInternalMessages) + { + EmitOutLine(PREFIX + message); + } - OnLogReceived(source, PREFIX, message, null); + OnLogReceived(source, PREFIX, message, null); } } @@ -348,7 +348,7 @@ namespace log4net.Util /// Writes log4net internal debug messages to the /// standard output stream. /// </summary> - /// <param name="source">The Type that generated this message.</param> + /// <param name="source">The Type that generated this message.</param> /// <param name="message">The message to log.</param> /// <param name="exception">An exception to log.</param> /// <remarks> @@ -361,16 +361,16 @@ namespace log4net.Util { if (IsDebugEnabled) { - if (EmitInternalMessages) - { - EmitOutLine(PREFIX + message); - if (exception != null) - { - EmitOutLine(exception.ToString()); - } - } - - OnLogReceived(source, PREFIX, message, exception); + if (EmitInternalMessages) + { + EmitOutLine(PREFIX + message); + if (exception != null) + { + EmitOutLine(exception.ToString()); + } + } + + OnLogReceived(source, PREFIX, message, exception); } } @@ -394,7 +394,7 @@ namespace log4net.Util /// Writes log4net internal warning messages to the /// standard error stream. /// </summary> - /// <param name="source">The Type that generated this message.</param> + /// <param name="source">The Type that generated this message.</param> /// <param name="message">The message to log.</param> /// <remarks> /// <para> @@ -406,12 +406,12 @@ namespace log4net.Util { if (IsWarnEnabled) { - if (EmitInternalMessages) - { - EmitErrorLine(WARN_PREFIX + message); - } + if (EmitInternalMessages) + { + EmitErrorLine(WARN_PREFIX + message); + } - OnLogReceived(source, WARN_PREFIX, message, null); + OnLogReceived(source, WARN_PREFIX, message, null); } } @@ -419,7 +419,7 @@ namespace log4net.Util /// Writes log4net internal warning messages to the /// standard error stream. /// </summary> - /// <param name="source">The Type that generated this message.</param> + /// <param name="source">The Type that generated this message.</param> /// <param name="message">The message to log.</param> /// <param name="exception">An exception to log.</param> /// <remarks> @@ -432,16 +432,16 @@ namespace log4net.Util { if (IsWarnEnabled) { - if (EmitInternalMessages) - { - EmitErrorLine(WARN_PREFIX + message); - if (exception != null) - { - EmitErrorLine(exception.ToString()); - } - } - - OnLogReceived(source, WARN_PREFIX, message, exception); + if (EmitInternalMessages) + { + EmitErrorLine(WARN_PREFIX + message); + if (exception != null) + { + EmitErrorLine(exception.ToString()); + } + } + + OnLogReceived(source, WARN_PREFIX, message, exception); } } @@ -465,7 +465,7 @@ namespace log4net.Util /// Writes log4net internal error messages to the /// standard error stream. /// </summary> - /// <param name="source">The Type that generated this message.</param> + /// <param name="source">The Type that generated this message.</param> /// <param name="message">The message to log.</param> /// <remarks> /// <para> @@ -477,12 +477,12 @@ namespace log4net.Util { if (IsErrorEnabled) { - if (EmitInternalMessages) - { - EmitErrorLine(ERR_PREFIX + message); - } + if (EmitInternalMessages) + { + EmitErrorLine(ERR_PREFIX + message); + } - OnLogReceived(source, ERR_PREFIX, message, null); + OnLogReceived(source, ERR_PREFIX, message, null); } } @@ -490,7 +490,7 @@ namespace log4net.Util /// Writes log4net internal error messages to the /// standard error stream. /// </summary> - /// <param name="source">The Type that generated this message.</param> + /// <param name="source">The Type that generated this message.</param> /// <param name="message">The message to log.</param> /// <param name="exception">An exception to log.</param> /// <remarks> @@ -503,16 +503,16 @@ namespace log4net.Util { if (IsErrorEnabled) { - if (EmitInternalMessages) - { - EmitErrorLine(ERR_PREFIX + message); - if (exception != null) - { - EmitErrorLine(exception.ToString()); - } - } - - OnLogReceived(source, ERR_PREFIX, message, exception); + if (EmitInternalMessages) + { + EmitErrorLine(ERR_PREFIX + message); + if (exception != null) + { + EmitErrorLine(exception.ToString()); + } + } + + OnLogReceived(source, ERR_PREFIX, message, exception); } } @@ -598,7 +598,7 @@ namespace log4net.Util /// </summary> private static bool s_quietMode = false; - private static bool s_emitInternalMessages = true; + private static bool s_emitInternalMessages = true; private const string PREFIX = "log4net: "; private const string ERR_PREFIX = "log4net:ERROR "; @@ -606,73 +606,73 @@ namespace log4net.Util #endregion Private Static Fields - /// <summary> - /// Subscribes to the LogLog.LogReceived event and stores messages - /// to the supplied IList instance. - /// </summary> - public class LogReceivedAdapter : IDisposable - { - private readonly IList items; - private readonly LogReceivedEventHandler handler; - - /// <summary> - /// - /// </summary> - /// <param name="items"></param> - public LogReceivedAdapter(IList items) - { - this.items = items; - - handler = new LogReceivedEventHandler(LogLog_LogReceived); - - LogReceived += handler; - } - - void LogLog_LogReceived(object source, LogReceivedEventArgs e) - { - items.Add(e.LogLog); - } - - /// <summary> - /// - /// </summary> - public IList Items - { - get { return items; } - } - - /// <summary> - /// - /// </summary> - public void Dispose() - { - LogReceived -= handler; - } - } + /// <summary> + /// Subscribes to the LogLog.LogReceived event and stores messages + /// to the supplied IList instance. + /// </summary> + public class LogReceivedAdapter : IDisposable + { + private readonly IList items; + private readonly LogReceivedEventHandler handler; + + /// <summary> + /// + /// </summary> + /// <param name="items"></param> + public LogReceivedAdapter(IList items) + { + this.items = items; + + handler = new LogReceivedEventHandler(LogLog_LogReceived); + + LogReceived += handler; + } + + void LogLog_LogReceived(object source, LogReceivedEventArgs e) + { + items.Add(e.LogLog); + } + + /// <summary> + /// + /// </summary> + public IList Items + { + get { return items; } + } + + /// <summary> + /// + /// </summary> + public void Dispose() + { + LogReceived -= handler; + } + } } - /// <summary> - /// - /// </summary> - public class LogReceivedEventArgs : EventArgs - { - private readonly LogLog loglog; - - /// <summary> - /// - /// </summary> - /// <param name="loglog"></param> - public LogReceivedEventArgs(LogLog loglog) - { - this.loglog = loglog; - } - - /// <summary> - /// - /// </summary> - public LogLog LogLog - { - get { return loglog; } - } - } + /// <summary> + /// + /// </summary> + public class LogReceivedEventArgs : EventArgs + { + private readonly LogLog loglog; + + /// <summary> + /// + /// </summary> + /// <param name="loglog"></param> + public LogReceivedEventArgs(LogLog loglog) + { + this.loglog = loglog; + } + + /// <summary> + /// + /// </summary> + public LogLog LogLog + { + get { return loglog; } + } + } }
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/LogicalThreadContextProperties.cs ---------------------------------------------------------------------- diff --git a/src/Util/LogicalThreadContextProperties.cs b/src/Util/LogicalThreadContextProperties.cs index bc1ac20..6a75619 100644 --- a/src/Util/LogicalThreadContextProperties.cs +++ b/src/Util/LogicalThreadContextProperties.cs @@ -214,9 +214,9 @@ namespace log4net.Util #endregion Internal Instance Methods - #region Private Static Methods + #region Private Static Methods - /// <summary> + /// <summary> /// Gets the call context get data. /// </summary> /// <returns>The peroperties dictionary stored in the call context</returns> @@ -226,14 +226,14 @@ namespace log4net.Util /// that we can wrap in an exception handler. /// </remarks> #if NET_4_0 || MONO_4_0 - [System.Security.SecuritySafeCritical] + [System.Security.SecuritySafeCritical] #endif - private static PropertiesDictionary GetLogicalProperties() + private static PropertiesDictionary GetLogicalProperties() { #if NETSTANDARD1_3 - return AsyncLocalDictionary.Value; + return AsyncLocalDictionary.Value; #elif NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 - return CallContext.LogicalGetData(c_SlotName) as PropertiesDictionary; + return CallContext.LogicalGetData(c_SlotName) as PropertiesDictionary; #else return CallContext.GetData(c_SlotName) as PropertiesDictionary; #endif @@ -249,9 +249,9 @@ namespace log4net.Util /// that we can wrap in an exception handler. /// </remarks> #if NET_4_0 || MONO_4_0 - [System.Security.SecuritySafeCritical] + [System.Security.SecuritySafeCritical] #endif - private static void SetLogicalProperties(PropertiesDictionary properties) + private static void SetLogicalProperties(PropertiesDictionary properties) { #if NETSTANDARD1_3 AsyncLocalDictionary.Value = properties; @@ -260,23 +260,23 @@ namespace log4net.Util #else CallContext.SetData(c_SlotName, properties); #endif - } + } - #endregion + #endregion - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the LogicalThreadContextProperties class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(LogicalThreadContextProperties); + /// <summary> + /// The fully qualified type of the LogicalThreadContextProperties class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(LogicalThreadContextProperties); - #endregion Private Static Fields - } + #endregion Private Static Fields + } } #endif http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/LogicalThreadContextStack.cs ---------------------------------------------------------------------- diff --git a/src/Util/LogicalThreadContextStack.cs b/src/Util/LogicalThreadContextStack.cs index 9f00886..b544834 100644 --- a/src/Util/LogicalThreadContextStack.cs +++ b/src/Util/LogicalThreadContextStack.cs @@ -26,16 +26,16 @@ using log4net.Core; namespace log4net.Util { - /// <summary> + /// <summary> /// Delegate type used for LogicalThreadContextStack's callbacks. /// </summary> - #if NET_2_0 || MONO_2_0 + #if NET_2_0 || MONO_2_0 public delegate void TwoArgAction<T1, T2>(T1 t1, T2 t2); - #else + #else public delegate void TwoArgAction(string t1, LogicalThreadContextStack t2); - #endif + #endif - /// <summary> + /// <summary> /// Implementation of Stack for the <see cref="log4net.LogicalThreadContext"/> /// </summary> /// <remarks> @@ -65,7 +65,7 @@ namespace log4net.Util /// </summary> #if NET_2_0 || MONO_2_0 private TwoArgAction<string, LogicalThreadContextStack> m_registerNew; - #else + #else private TwoArgAction m_registerNew; #endif @@ -83,7 +83,7 @@ namespace log4net.Util /// </remarks> #if NET_2_0 || MONO_2_0 internal LogicalThreadContextStack(string propertyKey, TwoArgAction<string, LogicalThreadContextStack> registerNew) - #else + #else internal LogicalThreadContextStack(string propertyKey, TwoArgAction registerNew) #endif { http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/NativeError.cs ---------------------------------------------------------------------- diff --git a/src/Util/NativeError.cs b/src/Util/NativeError.cs index 6fcaf7f..73cc2f7 100644 --- a/src/Util/NativeError.cs +++ b/src/Util/NativeError.cs @@ -115,11 +115,11 @@ namespace log4net.Util /// </para> /// </remarks> #if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 - [System.Security.SecuritySafeCritical] + [System.Security.SecuritySafeCritical] #elif !NETCF - [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode=true)] + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode=true)] #endif - public static NativeError GetLastError() + public static NativeError GetLastError() { int number = Marshal.GetLastWin32Error(); return new NativeError(number, NativeError.GetErrorMessage(number)); @@ -158,11 +158,11 @@ namespace log4net.Util /// </para> /// </remarks> #if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 - [System.Security.SecuritySafeCritical] + [System.Security.SecuritySafeCritical] #elif !NETCF - [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] #endif - public static string GetErrorMessage(int messageId) + public static string GetErrorMessage(int messageId) { // Win32 constants int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; // The function should allocates a buffer large enough to hold the formatted message http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/OnlyOnceErrorHandler.cs ---------------------------------------------------------------------- diff --git a/src/Util/OnlyOnceErrorHandler.cs b/src/Util/OnlyOnceErrorHandler.cs index 6303669..745cf65 100644 --- a/src/Util/OnlyOnceErrorHandler.cs +++ b/src/Util/OnlyOnceErrorHandler.cs @@ -105,43 +105,43 @@ namespace log4net.Util { if (m_firstTime) { - FirstError(message, e, errorCode); + FirstError(message, e, errorCode); } } - /// <summary> - /// Log the very first error - /// </summary> - /// <param name="message">The error message.</param> - /// <param name="e">The exception.</param> - /// <param name="errorCode">The internal error code.</param> - /// <remarks> - /// <para> - /// Sends the error information to <see cref="LogLog"/>'s Error method. - /// </para> - /// </remarks> - public virtual void FirstError(string message, Exception e, ErrorCode errorCode) { - m_enabledDateUtc = DateTime.UtcNow; - m_errorCode = errorCode; - m_exception = e; - m_message = message; - m_firstTime = false; - - if (LogLog.InternalDebugging && !LogLog.QuietMode) { - LogLog.Error(declaringType, "[" + m_prefix + "] ErrorCode: " + errorCode.ToString() + ". " + message, e); - } - } - - /// <summary> + /// <summary> + /// Log the very first error + /// </summary> + /// <param name="message">The error message.</param> + /// <param name="e">The exception.</param> + /// <param name="errorCode">The internal error code.</param> + /// <remarks> + /// <para> + /// Sends the error information to <see cref="LogLog"/>'s Error method. + /// </para> + /// </remarks> + public virtual void FirstError(string message, Exception e, ErrorCode errorCode) { + m_enabledDateUtc = DateTime.UtcNow; + m_errorCode = errorCode; + m_exception = e; + m_message = message; + m_firstTime = false; + + if (LogLog.InternalDebugging && !LogLog.QuietMode) { + LogLog.Error(declaringType, "[" + m_prefix + "] ErrorCode: " + errorCode.ToString() + ". " + message, e); + } + } + + /// <summary> /// Log an Error /// </summary> /// <param name="message">The error message.</param> /// <param name="e">The exception.</param> /// <remarks> - /// <para> - /// Invokes <see cref="FirstError"/> if and only if this is the first error or the first error after <see cref="Reset"/> has been called. - /// </para> - /// </remarks> + /// <para> + /// Invokes <see cref="FirstError"/> if and only if this is the first error or the first error after <see cref="Reset"/> has been called. + /// </para> + /// </remarks> public void Error(string message, Exception e) { Error(message, e, ErrorCode.GenericFailure); @@ -152,10 +152,10 @@ namespace log4net.Util /// </summary> /// <param name="message">The error message.</param> /// <remarks> - /// <para> - /// Invokes <see cref="FirstError"/> if and only if this is the first error or the first error after <see cref="Reset"/> has been called. - /// </para> - /// </remarks> + /// <para> + /// Invokes <see cref="FirstError"/> if and only if this is the first error or the first error after <see cref="Reset"/> has been called. + /// </para> + /// </remarks> public void Error(string message) { Error(message, null, ErrorCode.GenericFailure); @@ -187,19 +187,19 @@ namespace log4net.Util public DateTime EnabledDate { get - { - if (m_enabledDateUtc == DateTime.MinValue) return DateTime.MinValue; - return m_enabledDateUtc.ToLocalTime(); - } + { + if (m_enabledDateUtc == DateTime.MinValue) return DateTime.MinValue; + return m_enabledDateUtc.ToLocalTime(); + } } - /// <summary> - /// The UTC date the first error that trigged this error handler occured, or <see cref="DateTime.MinValue"/> if it has not been triggered. - /// </summary> - public DateTime EnabledDateUtc - { - get { return m_enabledDateUtc; } - } + /// <summary> + /// The UTC date the first error that trigged this error handler occured, or <see cref="DateTime.MinValue"/> if it has not been triggered. + /// </summary> + public DateTime EnabledDateUtc + { + get { return m_enabledDateUtc; } + } /// <summary> /// The message from the first error that trigged this error handler. @@ -269,13 +269,13 @@ namespace log4net.Util #region Private Static Fields - /// <summary> - /// The fully qualified type of the OnlyOnceErrorHandler class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> + /// <summary> + /// The fully qualified type of the OnlyOnceErrorHandler class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> private readonly static Type declaringType = typeof(OnlyOnceErrorHandler); #endregion http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/OptionConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/OptionConverter.cs b/src/Util/OptionConverter.cs index 199ddf7..f721979 100644 --- a/src/Util/OptionConverter.cs +++ b/src/Util/OptionConverter.cs @@ -652,14 +652,14 @@ namespace log4net.Util #region Private Static Fields - /// <summary> - /// The fully qualified type of the OptionConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(OptionConverter); + /// <summary> + /// The fully qualified type of the OptionConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(OptionConverter); private const string DELIM_START = "${"; private const char DELIM_STOP = '}'; http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternConverter.cs b/src/Util/PatternConverter.cs index 01eb782..0032fce 100644 --- a/src/Util/PatternConverter.cs +++ b/src/Util/PatternConverter.cs @@ -174,26 +174,26 @@ namespace log4net.Util } else { - string msg = null; - int len; - lock (m_formatWriter) - { - m_formatWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize); - - Convert(m_formatWriter, state); - - StringBuilder buf = m_formatWriter.GetStringBuilder(); - len = buf.Length; - if (len > m_max) - { - msg = buf.ToString(len - m_max, m_max); - len = m_max; - } - else - { - msg = buf.ToString(); - } - } + string msg = null; + int len; + lock (m_formatWriter) + { + m_formatWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize); + + Convert(m_formatWriter, state); + + StringBuilder buf = m_formatWriter.GetStringBuilder(); + len = buf.Length; + if (len > m_max) + { + msg = buf.ToString(len - m_max, m_max); + len = m_max; + } + else + { + msg = buf.ToString(); + } + } if (len < m_min) { @@ -383,15 +383,15 @@ namespace log4net.Util #endregion - private PropertiesDictionary properties; + private PropertiesDictionary properties; - /// <summary> - /// - /// </summary> - public PropertiesDictionary Properties - { - get { return properties; } - set { properties = value; } - } + /// <summary> + /// + /// </summary> + public PropertiesDictionary Properties + { + get { return properties; } + set { properties = value; } + } } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternParser.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternParser.cs b/src/Util/PatternParser.cs index cec4aa8..f784eec 100644 --- a/src/Util/PatternParser.cs +++ b/src/Util/PatternParser.cs @@ -325,7 +325,7 @@ namespace log4net.Util LogLog.Debug(declaringType, "Converter ["+converterName+"] Option ["+option+"] Format [min="+formattingInfo.Min+",max="+formattingInfo.Max+",leftAlign="+formattingInfo.LeftAlign+"]"); // Lookup the converter type - ConverterInfo converterInfo = (ConverterInfo)m_patternConverters[converterName]; + ConverterInfo converterInfo = (ConverterInfo)m_patternConverters[converterName]; if (converterInfo == null) { LogLog.Error(declaringType, "Unknown converter name ["+converterName+"] in conversion pattern."); @@ -336,20 +336,20 @@ namespace log4net.Util PatternConverter pc = null; try { - pc = (PatternConverter)Activator.CreateInstance(converterInfo.Type); + pc = (PatternConverter)Activator.CreateInstance(converterInfo.Type); } catch(Exception createInstanceEx) { - LogLog.Error(declaringType, "Failed to create instance of Type [" + converterInfo.Type.FullName + "] using default constructor. Exception: " + createInstanceEx.ToString()); + LogLog.Error(declaringType, "Failed to create instance of Type [" + converterInfo.Type.FullName + "] using default constructor. Exception: " + createInstanceEx.ToString()); } // formattingInfo variable is an instance variable, occasionally reset // and used over and over again pc.FormattingInfo = formattingInfo; pc.Option = option; - pc.Properties = converterInfo.Properties; + pc.Properties = converterInfo.Properties; - IOptionHandler optionHandler = pc as IOptionHandler; + IOptionHandler optionHandler = pc as IOptionHandler; if (optionHandler != null) { optionHandler.ActivateOptions(); @@ -419,17 +419,17 @@ namespace log4net.Util #endregion Private Instance Fields - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the PatternParser class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(PatternParser); + /// <summary> + /// The fully qualified type of the PatternParser class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(PatternParser); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternString.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternString.cs b/src/Util/PatternString.cs index 1d37bde..af61399 100644 --- a/src/Util/PatternString.cs +++ b/src/Util/PatternString.cs @@ -420,10 +420,10 @@ namespace log4net.Util // Add all the builtin patterns foreach(DictionaryEntry entry in s_globalRulesRegistry) { - ConverterInfo converterInfo = new ConverterInfo(); - converterInfo.Name = (string)entry.Key; - converterInfo.Type = (Type)entry.Value; - patternParser.PatternConverters.Add(entry.Key, converterInfo); + ConverterInfo converterInfo = new ConverterInfo(); + converterInfo.Name = (string)entry.Key; + converterInfo.Type = (Type)entry.Value; + patternParser.PatternConverters.Add(entry.Key, converterInfo); } // Add the instance patterns foreach(DictionaryEntry entry in m_instanceRulesRegistry) @@ -488,13 +488,13 @@ namespace log4net.Util /// </remarks> public void AddConverter(ConverterInfo converterInfo) { - if (converterInfo == null) throw new ArgumentNullException("converterInfo"); + if (converterInfo == null) throw new ArgumentNullException("converterInfo"); - if (!typeof(PatternConverter).IsAssignableFrom(converterInfo.Type)) - { - throw new ArgumentException("The converter type specified [" + converterInfo.Type + "] must be a subclass of log4net.Util.PatternConverter", "converterInfo"); - } - m_instanceRulesRegistry[converterInfo.Name] = converterInfo; + if (!typeof(PatternConverter).IsAssignableFrom(converterInfo.Type)) + { + throw new ArgumentException("The converter type specified [" + converterInfo.Type + "] must be a subclass of log4net.Util.PatternConverter", "converterInfo"); + } + m_instanceRulesRegistry[converterInfo.Name] = converterInfo; } /// <summary> @@ -512,11 +512,11 @@ namespace log4net.Util if (name == null) throw new ArgumentNullException("name"); if (type == null) throw new ArgumentNullException("type"); - ConverterInfo converterInfo = new ConverterInfo(); - converterInfo.Name = name; - converterInfo.Type = type; + ConverterInfo converterInfo = new ConverterInfo(); + converterInfo.Name = name; + converterInfo.Type = type; - AddConverter(converterInfo); + AddConverter(converterInfo); } } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/AppSettingPatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/AppSettingPatternConverter.cs b/src/Util/PatternStringConverters/AppSettingPatternConverter.cs index 9a8c9eb..3efe09c 100644 --- a/src/Util/PatternStringConverters/AppSettingPatternConverter.cs +++ b/src/Util/PatternStringConverters/AppSettingPatternConverter.cs @@ -31,83 +31,83 @@ using log4net.Repository; namespace log4net.Util.PatternStringConverters { - /// <summary> - /// AppSetting pattern converter - /// </summary> - /// <remarks> - /// <para> - /// This pattern converter reads appSettings from the application configuration file. - /// </para> - /// <para> - /// If the <see cref="PatternConverter.Option"/> is specified then that will be used to - /// lookup a single appSettings value. If no <see cref="PatternConverter.Option"/> is specified - /// then all appSettings will be dumped as a list of key value pairs. - /// </para> - /// <para> - /// A typical use is to specify a base directory for log files, e.g. - /// <example> - /// <![CDATA[ - /// <log4net> - /// <appender name="MyAppender" type="log4net.Appender.RollingFileAppender"> - /// <file type="log4net.Util.PatternString" value="appsetting{LogDirectory}MyApp.log"/> - /// ... - /// </appender> - /// </log4net> - /// ]]> - /// </example> - /// </para> - /// </remarks> - internal sealed class AppSettingPatternConverter : PatternConverter - { - private static IDictionary AppSettingsDictionary - { - get - { - if (_appSettingsHashTable == null) - { - Hashtable h = new Hashtable(); - foreach(string key in System.Configuration.ConfigurationManager.AppSettings) - { - h.Add(key, System.Configuration.ConfigurationManager.AppSettings[key]); - } - _appSettingsHashTable = h; - } - return _appSettingsHashTable; - } + /// <summary> + /// AppSetting pattern converter + /// </summary> + /// <remarks> + /// <para> + /// This pattern converter reads appSettings from the application configuration file. + /// </para> + /// <para> + /// If the <see cref="PatternConverter.Option"/> is specified then that will be used to + /// lookup a single appSettings value. If no <see cref="PatternConverter.Option"/> is specified + /// then all appSettings will be dumped as a list of key value pairs. + /// </para> + /// <para> + /// A typical use is to specify a base directory for log files, e.g. + /// <example> + /// <![CDATA[ + /// <log4net> + /// <appender name="MyAppender" type="log4net.Appender.RollingFileAppender"> + /// <file type="log4net.Util.PatternString" value="appsetting{LogDirectory}MyApp.log"/> + /// ... + /// </appender> + /// </log4net> + /// ]]> + /// </example> + /// </para> + /// </remarks> + internal sealed class AppSettingPatternConverter : PatternConverter + { + private static IDictionary AppSettingsDictionary + { + get + { + if (_appSettingsHashTable == null) + { + Hashtable h = new Hashtable(); + foreach(string key in System.Configuration.ConfigurationManager.AppSettings) + { + h.Add(key, System.Configuration.ConfigurationManager.AppSettings[key]); + } + _appSettingsHashTable = h; + } + return _appSettingsHashTable; + } - } - private static Hashtable _appSettingsHashTable; + } + private static Hashtable _appSettingsHashTable; - /// <summary> - /// Write the property value to the output - /// </summary> - /// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param> - /// <param name="state">null, state is not set</param> - /// <remarks> - /// <para> - /// Writes out the value of a named property. The property name - /// should be set in the <see cref="log4net.Util.PatternConverter.Option"/> - /// property. - /// </para> - /// <para> - /// If the <see cref="log4net.Util.PatternConverter.Option"/> is set to <c>null</c> - /// then all the properties are written as key value pairs. - /// </para> - /// </remarks> - override protected void Convert(TextWriter writer, object state) - { + /// <summary> + /// Write the property value to the output + /// </summary> + /// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param> + /// <param name="state">null, state is not set</param> + /// <remarks> + /// <para> + /// Writes out the value of a named property. The property name + /// should be set in the <see cref="log4net.Util.PatternConverter.Option"/> + /// property. + /// </para> + /// <para> + /// If the <see cref="log4net.Util.PatternConverter.Option"/> is set to <c>null</c> + /// then all the properties are written as key value pairs. + /// </para> + /// </remarks> + override protected void Convert(TextWriter writer, object state) + { - if (Option != null) - { - // Write the value for the specified key - WriteObject(writer, null, System.Configuration.ConfigurationManager.AppSettings[Option]); - } - else - { - // Write all the key value pairs - WriteDictionary(writer, null, AppSettingsDictionary); - } - } - } + if (Option != null) + { + // Write the value for the specified key + WriteObject(writer, null, System.Configuration.ConfigurationManager.AppSettings[Option]); + } + else + { + // Write all the key value pairs + WriteDictionary(writer, null, AppSettingsDictionary); + } + } + } } #endif http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/DatePatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/DatePatternConverter.cs b/src/Util/PatternStringConverters/DatePatternConverter.cs index 506d31e..af5ca86 100644 --- a/src/Util/PatternStringConverters/DatePatternConverter.cs +++ b/src/Util/PatternStringConverters/DatePatternConverter.cs @@ -173,17 +173,17 @@ namespace log4net.Util.PatternStringConverters } } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the DatePatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(DatePatternConverter); + /// <summary> + /// The fully qualified type of the DatePatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(DatePatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs b/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs index a216cea..db3d65c 100644 --- a/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs +++ b/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs @@ -24,75 +24,75 @@ using System.IO; namespace log4net.Util.PatternStringConverters { - /// <summary> - /// Write an <see cref="System.Environment.SpecialFolder" /> folder path to the output - /// </summary> - /// <remarks> - /// <para> - /// Write an special path environment folder path to the output writer. - /// The value of the <see cref="log4net.Util.PatternConverter.Option"/> determines - /// the name of the variable to output. <see cref="log4net.Util.PatternConverter.Option"/> - /// should be a value in the <see cref="System.Environment.SpecialFolder" /> enumeration. - /// </para> - /// </remarks> - /// <author>Ron Grabowski</author> - internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter - { - /// <summary> - /// Write an special path environment folder path to the output - /// </summary> - /// <param name="writer">the writer to write to</param> - /// <param name="state">null, state is not set</param> - /// <remarks> - /// <para> - /// Writes the special path environment folder path to the output <paramref name="writer"/>. - /// The name of the special path environment folder path to output must be set - /// using the <see cref="log4net.Util.PatternConverter.Option"/> - /// property. - /// </para> - /// </remarks> - override protected void Convert(TextWriter writer, object state) - { - try - { - if (Option != null && Option.Length > 0) - { - Environment.SpecialFolder specialFolder = - (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), Option, true); + /// <summary> + /// Write an <see cref="System.Environment.SpecialFolder" /> folder path to the output + /// </summary> + /// <remarks> + /// <para> + /// Write an special path environment folder path to the output writer. + /// The value of the <see cref="log4net.Util.PatternConverter.Option"/> determines + /// the name of the variable to output. <see cref="log4net.Util.PatternConverter.Option"/> + /// should be a value in the <see cref="System.Environment.SpecialFolder" /> enumeration. + /// </para> + /// </remarks> + /// <author>Ron Grabowski</author> + internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter + { + /// <summary> + /// Write an special path environment folder path to the output + /// </summary> + /// <param name="writer">the writer to write to</param> + /// <param name="state">null, state is not set</param> + /// <remarks> + /// <para> + /// Writes the special path environment folder path to the output <paramref name="writer"/>. + /// The name of the special path environment folder path to output must be set + /// using the <see cref="log4net.Util.PatternConverter.Option"/> + /// property. + /// </para> + /// </remarks> + override protected void Convert(TextWriter writer, object state) + { + try + { + if (Option != null && Option.Length > 0) + { + Environment.SpecialFolder specialFolder = + (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), Option, true); - string envFolderPathValue = Environment.GetFolderPath(specialFolder); - if (envFolderPathValue != null && envFolderPathValue.Length > 0) - { - writer.Write(envFolderPathValue); - } - } - } - catch (System.Security.SecurityException secEx) - { - // This security exception will occur if the caller does not have - // unrestricted environment permission. If this occurs the expansion - // will be skipped with the following warning message. - LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.", secEx); - } - catch (Exception ex) - { - LogLog.Error(declaringType, "Error occurred while converting environment variable.", ex); - } - } + string envFolderPathValue = Environment.GetFolderPath(specialFolder); + if (envFolderPathValue != null && envFolderPathValue.Length > 0) + { + writer.Write(envFolderPathValue); + } + } + } + catch (System.Security.SecurityException secEx) + { + // This security exception will occur if the caller does not have + // unrestricted environment permission. If this occurs the expansion + // will be skipped with the following warning message. + LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.", secEx); + } + catch (Exception ex) + { + LogLog.Error(declaringType, "Error occurred while converting environment variable.", ex); + } + } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the EnvironmentFolderPathPatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter); + /// <summary> + /// The fully qualified type of the EnvironmentFolderPathPatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter); - #endregion Private Static Fields - } + #endregion Private Static Fields + } } #endif // !NETCF \ No newline at end of file http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs b/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs index 4e07d10..32c346a 100644 --- a/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs +++ b/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs @@ -66,17 +66,17 @@ namespace log4net.Util.PatternStringConverters string envValue = Environment.GetEnvironmentVariable(this.Option); #if NET_2_0 - // If we didn't see it for the process, try a user level variable. - if (envValue == null) - { - envValue = Environment.GetEnvironmentVariable(this.Option, EnvironmentVariableTarget.User); - } + // If we didn't see it for the process, try a user level variable. + if (envValue == null) + { + envValue = Environment.GetEnvironmentVariable(this.Option, EnvironmentVariableTarget.User); + } - // If we still didn't find it, try a system level one. - if (envValue == null) - { - envValue = Environment.GetEnvironmentVariable(this.Option, EnvironmentVariableTarget.Machine); - } + // If we still didn't find it, try a system level one. + if (envValue == null) + { + envValue = Environment.GetEnvironmentVariable(this.Option, EnvironmentVariableTarget.Machine); + } #endif if (envValue != null && envValue.Length > 0) @@ -98,18 +98,18 @@ namespace log4net.Util.PatternStringConverters } } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the EnvironmentPatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(EnvironmentPatternConverter); + /// <summary> + /// The fully qualified type of the EnvironmentPatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(EnvironmentPatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/IdentityPatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/IdentityPatternConverter.cs b/src/Util/PatternStringConverters/IdentityPatternConverter.cs index 4dc2fa5..d5144eb 100644 --- a/src/Util/PatternStringConverters/IdentityPatternConverter.cs +++ b/src/Util/PatternStringConverters/IdentityPatternConverter.cs @@ -72,17 +72,17 @@ namespace log4net.Util.PatternStringConverters #endif } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the IdentityPatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(IdentityPatternConverter); + /// <summary> + /// The fully qualified type of the IdentityPatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(IdentityPatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs b/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs index 687e16b..33ec9b4 100644 --- a/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs +++ b/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs @@ -47,9 +47,9 @@ namespace log4net.Util.PatternStringConverters /// </para> /// </remarks> #if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 - [System.Security.SecuritySafeCritical] + [System.Security.SecuritySafeCritical] #endif - override protected void Convert(TextWriter writer, object state) + override protected void Convert(TextWriter writer, object state) { #if (NETCF || SSCLI) // On compact framework there is no System.Diagnostics.Process class @@ -70,17 +70,17 @@ namespace log4net.Util.PatternStringConverters #endif } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the ProcessIdPatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(ProcessIdPatternConverter); + /// <summary> + /// The fully qualified type of the ProcessIdPatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(ProcessIdPatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/RandomStringPatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/RandomStringPatternConverter.cs b/src/Util/PatternStringConverters/RandomStringPatternConverter.cs index 70cffdd..e480b15 100644 --- a/src/Util/PatternStringConverters/RandomStringPatternConverter.cs +++ b/src/Util/PatternStringConverters/RandomStringPatternConverter.cs @@ -140,17 +140,17 @@ namespace log4net.Util.PatternStringConverters } } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the RandomStringPatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(RandomStringPatternConverter); + /// <summary> + /// The fully qualified type of the RandomStringPatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(RandomStringPatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/UserNamePatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/UserNamePatternConverter.cs b/src/Util/PatternStringConverters/UserNamePatternConverter.cs index 0fbaad7..b4a15f9 100644 --- a/src/Util/PatternStringConverters/UserNamePatternConverter.cs +++ b/src/Util/PatternStringConverters/UserNamePatternConverter.cs @@ -72,17 +72,17 @@ namespace log4net.Util.PatternStringConverters #endif } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the UserNamePatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(UserNamePatternConverter); + /// <summary> + /// The fully qualified type of the UserNamePatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(UserNamePatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PatternStringConverters/UtcDatePatternConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/PatternStringConverters/UtcDatePatternConverter.cs b/src/Util/PatternStringConverters/UtcDatePatternConverter.cs index 155314c..61d831a 100644 --- a/src/Util/PatternStringConverters/UtcDatePatternConverter.cs +++ b/src/Util/PatternStringConverters/UtcDatePatternConverter.cs @@ -70,17 +70,17 @@ namespace log4net.Util.PatternStringConverters } } - #region Private Static Fields + #region Private Static Fields - /// <summary> - /// The fully qualified type of the UtcDatePatternConverter class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(UtcDatePatternConverter); + /// <summary> + /// The fully qualified type of the UtcDatePatternConverter class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(UtcDatePatternConverter); - #endregion Private Static Fields + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/PropertyEntry.cs ---------------------------------------------------------------------- diff --git a/src/Util/PropertyEntry.cs b/src/Util/PropertyEntry.cs index 3357d98..d34fcdb 100644 --- a/src/Util/PropertyEntry.cs +++ b/src/Util/PropertyEntry.cs @@ -21,60 +21,60 @@ namespace log4net.Util { - /// <summary> - /// A class to hold the key and data for a property set in the config file - /// </summary> - /// <remarks> - /// <para> - /// A class to hold the key and data for a property set in the config file - /// </para> - /// </remarks> - public class PropertyEntry - { - private string m_key = null; - private object m_value = null; + /// <summary> + /// A class to hold the key and data for a property set in the config file + /// </summary> + /// <remarks> + /// <para> + /// A class to hold the key and data for a property set in the config file + /// </para> + /// </remarks> + public class PropertyEntry + { + private string m_key = null; + private object m_value = null; - /// <summary> - /// Property Key - /// </summary> - /// <value> - /// Property Key - /// </value> - /// <remarks> - /// <para> - /// Property Key. - /// </para> - /// </remarks> - public string Key - { - get { return m_key; } - set { m_key = value; } - } + /// <summary> + /// Property Key + /// </summary> + /// <value> + /// Property Key + /// </value> + /// <remarks> + /// <para> + /// Property Key. + /// </para> + /// </remarks> + public string Key + { + get { return m_key; } + set { m_key = value; } + } - /// <summary> - /// Property Value - /// </summary> - /// <value> - /// Property Value - /// </value> - /// <remarks> - /// <para> - /// Property Value. - /// </para> - /// </remarks> - public object Value - { - get { return m_value; } - set { m_value = value; } - } + /// <summary> + /// Property Value + /// </summary> + /// <value> + /// Property Value + /// </value> + /// <remarks> + /// <para> + /// Property Value. + /// </para> + /// </remarks> + public object Value + { + get { return m_value; } + set { m_value = value; } + } - /// <summary> - /// Override <c>Object.ToString</c> to return sensible debug info - /// </summary> - /// <returns>string info about this object</returns> - public override string ToString() - { - return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")"; - } - } + /// <summary> + /// Override <c>Object.ToString</c> to return sensible debug info + /// </summary> + /// <returns>string info about this object</returns> + public override string ToString() + { + return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")"; + } + } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/ReadOnlyPropertiesDictionary.cs ---------------------------------------------------------------------- diff --git a/src/Util/ReadOnlyPropertiesDictionary.cs b/src/Util/ReadOnlyPropertiesDictionary.cs index 26b3adc..e7e0fe1 100644 --- a/src/Util/ReadOnlyPropertiesDictionary.cs +++ b/src/Util/ReadOnlyPropertiesDictionary.cs @@ -205,22 +205,22 @@ namespace log4net.Util /// </para> /// </remarks> #if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 - [System.Security.SecurityCritical] + [System.Security.SecurityCritical] #else [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] #endif - public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { foreach(DictionaryEntry entry in InnerHashtable.Clone() as IDictionary) { string entryKey = entry.Key as string; object entryValue = entry.Value; - // If value is serializable then we add it to the list + // If value is serializable then we add it to the list #if NETSTANDARD1_3 - bool isSerializable = entryValue.GetType().GetTypeInfo().IsSerializable; + bool isSerializable = entryValue.GetType().GetTypeInfo().IsSerializable; #else - bool isSerializable = entryValue.GetType().IsSerializable; + bool isSerializable = entryValue.GetType().IsSerializable; #endif if (entryKey != null && entryValue != null && isSerializable) { http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/ReaderWriterLock.cs ---------------------------------------------------------------------- diff --git a/src/Util/ReaderWriterLock.cs b/src/Util/ReaderWriterLock.cs index b41bb29..f5c69ac 100644 --- a/src/Util/ReaderWriterLock.cs +++ b/src/Util/ReaderWriterLock.cs @@ -88,12 +88,12 @@ namespace log4net.Util { #if HAS_READERWRITERLOCK #if HAS_READERWRITERLOCKSLIM - // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443 - try { } - finally - { + // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443 + try { } + finally + { m_lock.EnterReadLock(); - } + } #else m_lock.AcquireReaderLock(-1); #endif @@ -137,12 +137,12 @@ namespace log4net.Util { #if HAS_READERWRITERLOCK #if HAS_READERWRITERLOCKSLIM - // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443 - try { } - finally - { + // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443 + try { } + finally + { m_lock.EnterWriteLock(); - } + } #else m_lock.AcquireWriterLock(-1); #endif http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/SystemInfo.cs ---------------------------------------------------------------------- diff --git a/src/Util/SystemInfo.cs b/src/Util/SystemInfo.cs index e8fbf71..72e8453 100644 --- a/src/Util/SystemInfo.cs +++ b/src/Util/SystemInfo.cs @@ -394,35 +394,35 @@ namespace log4net.Util /// will be set per AppDomain. /// </para> /// </remarks> - [Obsolete("Use ProcessStartTimeUtc and convert to local time if needed.")] + [Obsolete("Use ProcessStartTimeUtc and convert to local time if needed.")] public static DateTime ProcessStartTime { get { return s_processStartTimeUtc.ToLocalTime(); } } - /// <summary> - /// Get the UTC start time for the current process. - /// </summary> - /// <remarks> - /// <para> - /// This is the UTC time at which the log4net library was loaded into the - /// AppDomain. Due to reports of a hang in the call to <c>System.Diagnostics.Process.StartTime</c> - /// this is not the start time for the current process. - /// </para> - /// <para> - /// The log4net library should be loaded by an application early during its - /// startup, therefore this start time should be a good approximation for - /// the actual start time. - /// </para> - /// <para> - /// Note that AppDomains may be loaded and unloaded within the - /// same process without the process terminating, however this start time - /// will be set per AppDomain. - /// </para> - /// </remarks> - public static DateTime ProcessStartTimeUtc - { - get { return s_processStartTimeUtc; } + /// <summary> + /// Get the UTC start time for the current process. + /// </summary> + /// <remarks> + /// <para> + /// This is the UTC time at which the log4net library was loaded into the + /// AppDomain. Due to reports of a hang in the call to <c>System.Diagnostics.Process.StartTime</c> + /// this is not the start time for the current process. + /// </para> + /// <para> + /// The log4net library should be loaded by an application early during its + /// startup, therefore this start time should be a good approximation for + /// the actual start time. + /// </para> + /// <para> + /// Note that AppDomains may be loaded and unloaded within the + /// same process without the process terminating, however this start time + /// will be set per AppDomain. + /// </para> + /// </remarks> + public static DateTime ProcessStartTimeUtc + { + get { return s_processStartTimeUtc; } } /// <summary> @@ -485,7 +485,7 @@ namespace log4net.Util #if NETCF return "Not supported on Microsoft .NET Compact Framework"; #elif NETSTANDARD1_3 // TODO Assembly.Location available in netstandard1.5 - return "Not supported on .NET Core"; + return "Not supported on .NET Core"; #else if (myAssembly.GlobalAssemblyCache) { @@ -752,20 +752,20 @@ namespace log4net.Util { // Found type in loaded assembly LogLog.Debug(declaringType, "Loaded type ["+typeName+"] from assembly ["+assembly.FullName+"] by searching loaded assemblies."); - if (assembly.GlobalAssemblyCache) - { - fallback = t; - } - else - { - return t; - } + if (assembly.GlobalAssemblyCache) + { + fallback = t; + } + else + { + return t; + } } } - if (fallback != null) - { - return fallback; - } + if (fallback != null) + { + return fallback; + } } // Didn't find the type @@ -937,20 +937,20 @@ namespace log4net.Util #endif } - /// <summary> - /// Parse a string into an <see cref="Int16"/> value - /// </summary> - /// <param name="s">the string to parse</param> - /// <param name="val">out param where the parsed value is placed</param> - /// <returns><c>true</c> if the string was able to be parsed into an integer</returns> - /// <remarks> - /// <para> - /// Attempts to parse the string into an integer. If the string cannot - /// be parsed then this method returns <c>false</c>. The method does not throw an exception. - /// </para> - /// </remarks> - public static bool TryParse(string s, out short val) - { + /// <summary> + /// Parse a string into an <see cref="Int16"/> value + /// </summary> + /// <param name="s">the string to parse</param> + /// <param name="val">out param where the parsed value is placed</param> + /// <returns><c>true</c> if the string was able to be parsed into an integer</returns> + /// <remarks> + /// <para> + /// Attempts to parse the string into an integer. If the string cannot + /// be parsed then this method returns <c>false</c>. The method does not throw an exception. + /// </para> + /// </remarks> + public static bool TryParse(string s, out short val) + { #if NETCF val = 0; try @@ -964,28 +964,28 @@ namespace log4net.Util return false; #else - // Initialise out param - val = 0; - - try - { - double doubleVal; - if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal)) - { - val = Convert.ToInt16(doubleVal); - return true; - } - } - catch - { - // Ignore exception, just return false - } - - return false; + // Initialise out param + val = 0; + + try + { + double doubleVal; + if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal)) + { + val = Convert.ToInt16(doubleVal); + return true; + } + } + catch + { + // Ignore exception, just return false + } + + return false; #endif - } + } - /// <summary> + /// <summary> /// Lookup an application setting /// </summary> /// <param name="key">the application settings key to lookup</param> @@ -1085,28 +1085,28 @@ namespace log4net.Util #endif } - /// <summary> - /// Tests two strings for equality, the ignoring case. - /// </summary> - /// <remarks> - /// If the platform permits, culture information is ignored completely (ordinal comparison). - /// The aim of this method is to provide a fast comparison that deals with <c>null</c> and ignores different casing. - /// It is not supposed to deal with various, culture-specific habits. - /// Use it to compare against pure ASCII constants, like keywords etc. - /// </remarks> - /// <param name="a">The one string.</param> - /// <param name="b">The other string.</param> - /// <returns><c>true</c> if the strings are equal, <c>false</c> otherwise.</returns> - public static Boolean EqualsIgnoringCase(String a, String b) - { + /// <summary> + /// Tests two strings for equality, the ignoring case. + /// </summary> + /// <remarks> + /// If the platform permits, culture information is ignored completely (ordinal comparison). + /// The aim of this method is to provide a fast comparison that deals with <c>null</c> and ignores different casing. + /// It is not supposed to deal with various, culture-specific habits. + /// Use it to compare against pure ASCII constants, like keywords etc. + /// </remarks> + /// <param name="a">The one string.</param> + /// <param name="b">The other string.</param> + /// <returns><c>true</c> if the strings are equal, <c>false</c> otherwise.</returns> + public static Boolean EqualsIgnoringCase(String a, String b) + { #if NET_1_0 || NET_1_1 || NETCF_1_0 - return string.Compare(a, b, true, System.Globalization.CultureInfo.InvariantCulture) == 0 + return string.Compare(a, b, true, System.Globalization.CultureInfo.InvariantCulture) == 0 #elif NETSTANDARD1_3 - return CultureInfo.InvariantCulture.CompareInfo.Compare(a, b, CompareOptions.IgnoreCase) == 0; + return CultureInfo.InvariantCulture.CompareInfo.Compare(a, b, CompareOptions.IgnoreCase) == 0; #else // >= .NET-2.0 - return String.Equals(a, b, StringComparison.OrdinalIgnoreCase); + return String.Equals(a, b, StringComparison.OrdinalIgnoreCase); #endif - } + } #endregion Public Static Methods @@ -1168,14 +1168,14 @@ namespace log4net.Util #region Private Static Fields - /// <summary> - /// The fully qualified type of the SystemInfo class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(SystemInfo); + /// <summary> + /// The fully qualified type of the SystemInfo class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(SystemInfo); /// <summary> /// Cache the host name for the current machine http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/SystemStringFormat.cs ---------------------------------------------------------------------- diff --git a/src/Util/SystemStringFormat.cs b/src/Util/SystemStringFormat.cs index 760ca32..8a50433 100644 --- a/src/Util/SystemStringFormat.cs +++ b/src/Util/SystemStringFormat.cs @@ -221,17 +221,17 @@ namespace log4net.Util #endregion StringFormat - #region Private Static Fields - - /// <summary> - /// The fully qualified type of the SystemStringFormat class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(SystemStringFormat); - - #endregion Private Static Fields + #region Private Static Fields + + /// <summary> + /// The fully qualified type of the SystemStringFormat class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(SystemStringFormat); + + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/ThreadContextStacks.cs ---------------------------------------------------------------------- diff --git a/src/Util/ThreadContextStacks.cs b/src/Util/ThreadContextStacks.cs index c127757..df7a312 100644 --- a/src/Util/ThreadContextStacks.cs +++ b/src/Util/ThreadContextStacks.cs @@ -107,18 +107,18 @@ namespace log4net.Util #endregion Public Instance Properties - #region Private Static Fields - - /// <summary> - /// The fully qualified type of the ThreadContextStacks class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(ThreadContextStacks); - - #endregion Private Static Fields + #region Private Static Fields + + /// <summary> + /// The fully qualified type of the ThreadContextStacks class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(ThreadContextStacks); + + #endregion Private Static Fields } } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/Transform.cs ---------------------------------------------------------------------- diff --git a/src/Util/Transform.cs b/src/Util/Transform.cs index dafb223..2538419 100644 --- a/src/Util/Transform.cs +++ b/src/Util/Transform.cs @@ -191,9 +191,9 @@ namespace log4net.Util private const string CDATA_END = "]]>"; private const string CDATA_UNESCAPABLE_TOKEN = "]]"; - /// <summary> - /// Characters illegal in XML 1.0 - /// </summary> + /// <summary> + /// Characters illegal in XML 1.0 + /// </summary> private static Regex INVALIDCHARS=new Regex(@"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD]",RegexOptions.Compiled); #endregion Private Static Fields } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/TypeConverters/BooleanConverter.cs ---------------------------------------------------------------------- diff --git a/src/Util/TypeConverters/BooleanConverter.cs b/src/Util/TypeConverters/BooleanConverter.cs index 560e81c..ed08802 100644 --- a/src/Util/TypeConverters/BooleanConverter.cs +++ b/src/Util/TypeConverters/BooleanConverter.cs @@ -65,11 +65,11 @@ namespace log4net.Util.TypeConverters /// <see cref="String"/> argument to a <see cref="Boolean"/>. /// </para> /// </remarks> - /// <exception cref="ConversionNotSupportedException"> - /// The <paramref name="source"/> object cannot be converted to the - /// target type. To check for this condition use the <see cref="CanConvertFrom"/> - /// method. - /// </exception> + /// <exception cref="ConversionNotSupportedException"> + /// The <paramref name="source"/> object cannot be converted to the + /// target type. To check for this condition use the <see cref="CanConvertFrom"/> + /// method. + /// </exception> public object ConvertFrom(object source) { string str = source as string; http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/TypeConverters/ConverterRegistry.cs ---------------------------------------------------------------------- diff --git a/src/Util/TypeConverters/ConverterRegistry.cs b/src/Util/TypeConverters/ConverterRegistry.cs index 78f7b4a..17ceffb 100644 --- a/src/Util/TypeConverters/ConverterRegistry.cs +++ b/src/Util/TypeConverters/ConverterRegistry.cs @@ -277,14 +277,14 @@ namespace log4net.Util.TypeConverters #region Private Static Fields - /// <summary> - /// The fully qualified type of the ConverterRegistry class. - /// </summary> - /// <remarks> - /// Used by the internal logger to record the Type of the - /// log message. - /// </remarks> - private readonly static Type declaringType = typeof(ConverterRegistry); + /// <summary> + /// The fully qualified type of the ConverterRegistry class. + /// </summary> + /// <remarks> + /// Used by the internal logger to record the Type of the + /// log message. + /// </remarks> + private readonly static Type declaringType = typeof(ConverterRegistry); /// <summary> /// Mapping from <see cref="Type" /> to type converter. http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/src/Util/WindowsSecurityContext.cs ---------------------------------------------------------------------- diff --git a/src/Util/WindowsSecurityContext.cs b/src/Util/WindowsSecurityContext.cs index f81f765..9b4e6e0 100644 --- a/src/Util/WindowsSecurityContext.cs +++ b/src/Util/WindowsSecurityContext.cs @@ -276,10 +276,10 @@ namespace log4net.Util /// </para> /// </remarks> #if NET_4_0 || MONO_4_0 - [System.Security.SecuritySafeCritical] + [System.Security.SecuritySafeCritical] #endif - [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] - private static WindowsIdentity LogonUser(string userName, string domainName, string password) + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] + private static WindowsIdentity LogonUser(string userName, string domainName, string password) { const int LOGON32_PROVIDER_DEFAULT = 0; //This parameter causes LogonUser to create a primary token. http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/82c3e389/tests/src/Appender/AdoNet/Log4NetCommand.cs ---------------------------------------------------------------------- diff --git a/tests/src/Appender/AdoNet/Log4NetCommand.cs b/tests/src/Appender/AdoNet/Log4NetCommand.cs index 98beb8e..4c3aac0 100644 --- a/tests/src/Appender/AdoNet/Log4NetCommand.cs +++ b/tests/src/Appender/AdoNet/Log4NetCommand.cs @@ -24,121 +24,121 @@ using System.Data; namespace log4net.Tests.Appender.AdoNet { - public class Log4NetCommand : IDbCommand - { - #region AdoNetAppender - - private static Log4NetCommand mostRecentInstance; - - private IDbTransaction transaction; - private string commandText; - private readonly IDataParameterCollection parameters; - private CommandType commandType; - private int executeNonQueryCount; - - public Log4NetCommand() - { - mostRecentInstance = this; - - parameters = new Log4NetParameterCollection(); - } - - public void Dispose() - { - // empty - } - - public IDbTransaction Transaction - { - get { return transaction; } - set { transaction = value; } - } - - public int ExecuteNonQuery() - { - executeNonQueryCount++; - return 0; - } - - public int ExecuteNonQueryCount - { - get { return executeNonQueryCount; } - } - - public IDbDataParameter CreateParameter() - { - return new Log4NetParameter(); - } - - public string CommandText - { - get { return commandText; } - set { commandText = value; } - } - - public CommandType CommandType - { - get { return commandType; } - set { commandType = value; } - } - - public void Prepare() - { - // empty - } - - public IDataParameterCollection Parameters - { - get { return parameters; } - } - - public static Log4NetCommand MostRecentInstance - { - get { return mostRecentInstance; } - } - - #endregion - - #region Not Implemented - - public void Cancel() - { - throw new NotImplementedException(); - } - - public IDataReader ExecuteReader() - { - throw new NotImplementedException(); - } - - public IDataReader ExecuteReader(CommandBehavior behavior) - { - throw new NotImplementedException(); - } - - public object ExecuteScalar() - { - throw new NotImplementedException(); - } - - public IDbConnection Connection - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public int CommandTimeout - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public UpdateRowSource UpdatedRowSource - { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - #endregion - } + public class Log4NetCommand : IDbCommand + { + #region AdoNetAppender + + private static Log4NetCommand mostRecentInstance; + + private IDbTransaction transaction; + private string commandText; + private readonly IDataParameterCollection parameters; + private CommandType commandType; + private int executeNonQueryCount; + + public Log4NetCommand() + { + mostRecentInstance = this; + + parameters = new Log4NetParameterCollection(); + } + + public void Dispose() + { + // empty + } + + public IDbTransaction Transaction + { + get { return transaction; } + set { transaction = value; } + } + + public int ExecuteNonQuery() + { + executeNonQueryCount++; + return 0; + } + + public int ExecuteNonQueryCount + { + get { return executeNonQueryCount; } + } + + public IDbDataParameter CreateParameter() + { + return new Log4NetParameter(); + } + + public string CommandText + { + get { return commandText; } + set { commandText = value; } + } + + public CommandType CommandType + { + get { return commandType; } + set { commandType = value; } + } + + public void Prepare() + { + // empty + } + + public IDataParameterCollection Parameters + { + get { return parameters; } + } + + public static Log4NetCommand MostRecentInstance + { + get { return mostRecentInstance; } + } + + #endregion + + #region Not Implemented + + public void Cancel() + { + throw new NotImplementedException(); + } + + public IDataReader ExecuteReader() + { + throw new NotImplementedException(); + } + + public IDataReader ExecuteReader(CommandBehavior behavior) + { + throw new NotImplementedException(); + } + + public object ExecuteScalar() + { + throw new NotImplementedException(); + } + + public IDbConnection Connection + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public int CommandTimeout + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public UpdateRowSource UpdatedRowSource + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + #endregion + } }
