http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/AnsiColorTerminalAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/AnsiColorTerminalAppender.cs b/src/Appender/AnsiColorTerminalAppender.cs index 2f07476..a73b2c0 100644 --- a/src/Appender/AnsiColorTerminalAppender.cs +++ b/src/Appender/AnsiColorTerminalAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -33,11 +33,11 @@ namespace log4net.Appender /// <remarks> /// <para> /// AnsiColorTerminalAppender appends log events to the standard output stream - /// or the error output stream using a layout specified by the + /// or the error output stream using a layout specified by the /// user. It also allows the color of a specific level of message to be set. /// </para> /// <note> - /// This appender expects the terminal to understand the VT100 control set + /// This appender expects the terminal to understand the VT100 control set /// in order to interpret the color codes. If the terminal or console does not /// understand the control codes the behavior is not defined. /// </note> @@ -47,11 +47,11 @@ namespace log4net.Appender /// error stream. /// </para> /// <para> - /// NOTE: This appender writes each message to the <c>System.Console.Out</c> or + /// NOTE: This appender writes each message to the <c>System.Console.Out</c> or /// <c>System.Console.Error</c> that is set at the time the event is appended. - /// Therefore it is possible to programmatically redirect the output of this appender + /// Therefore it is possible to programmatically redirect the output of this appender /// (for example NUnit does this to capture program output). While this is the desired - /// behavior of this appender it may have security implications in your application. + /// behavior of this appender it may have security implications in your application. /// </para> /// <para> /// When configuring the ANSI colored terminal appender, a mapping should be @@ -162,7 +162,7 @@ namespace log4net.Appender } /// <summary> - /// The enum of possible foreground or background color values for + /// The enum of possible foreground or background color values for /// use with the color mapping method /// </summary> /// <remarks> @@ -222,10 +222,10 @@ namespace log4net.Appender /// Initializes a new instance of the <see cref="AnsiColorTerminalAppender" /> class. /// </summary> /// <remarks> - /// The instance of the <see cref="AnsiColorTerminalAppender" /> class is set up to write + /// The instance of the <see cref="AnsiColorTerminalAppender" /> class is set up to write /// to the standard output stream. /// </remarks> - public AnsiColorTerminalAppender() + public AnsiColorTerminalAppender() { } @@ -256,8 +256,8 @@ namespace log4net.Appender if (SystemInfo.EqualsIgnoringCase(ConsoleError, trimmedTargetName)) { m_writeToErrorStream = true; - } - else + } + else { m_writeToErrorStream = false; } @@ -296,7 +296,7 @@ namespace log4net.Appender /// The format of the output will depend on the appender's layout. /// </para> /// </remarks> - override protected void Append(log4net.Core.LoggingEvent loggingEvent) + override protected void Append(log4net.Core.LoggingEvent loggingEvent) { string loggingMessage = RenderLoggingEvent(loggingEvent); @@ -314,26 +314,26 @@ namespace log4net.Appender // are inserted afterwards. if (loggingMessage.Length > 1) { - if (loggingMessage.EndsWith("\r\n") || loggingMessage.EndsWith("\n\r")) + if (loggingMessage.EndsWith("\r\n") || loggingMessage.EndsWith("\n\r")) { loggingMessage = loggingMessage.Insert(loggingMessage.Length - 2, PostEventCodes); - } - else if (loggingMessage.EndsWith("\n") || loggingMessage.EndsWith("\r")) + } + else if (loggingMessage.EndsWith("\n") || loggingMessage.EndsWith("\r")) { loggingMessage = loggingMessage.Insert(loggingMessage.Length - 1, PostEventCodes); - } - else + } + else { loggingMessage = loggingMessage + PostEventCodes; } } else { - if (loggingMessage[0] == '\n' || loggingMessage[0] == '\r') + if (loggingMessage[0] == '\n' || loggingMessage[0] == '\r') { loggingMessage = PostEventCodes + loggingMessage; - } - else + } + else { loggingMessage = loggingMessage + PostEventCodes; } @@ -354,7 +354,7 @@ namespace log4net.Appender Console.Write(loggingMessage); } #endif - + } /// <summary> @@ -390,24 +390,24 @@ namespace log4net.Appender #region Public Static Fields /// <summary> - /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console + /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console /// standard output stream. /// </summary> /// <remarks> /// <para> - /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console + /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console /// standard output stream. /// </para> /// </remarks> public const string ConsoleOut = "Console.Out"; /// <summary> - /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console + /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console /// standard error output stream. /// </summary> /// <remarks> /// <para> - /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console + /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console /// standard error output stream. /// </para> /// </remarks> @@ -516,7 +516,7 @@ namespace log4net.Appender buf.Append("\x1b[0;"); int lightAdjustment = ((m_attributes & AnsiAttributes.Light) > 0) ? 60 : 0; - + // set the foreground color buf.Append(30 + lightAdjustment + (int)m_foreColor); buf.Append(';');
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/AppenderCollection.cs ---------------------------------------------------------------------- diff --git a/src/Appender/AppenderCollection.cs b/src/Appender/AppenderCollection.cs index 21987b8..97bf302 100644 --- a/src/Appender/AppenderCollection.cs +++ b/src/Appender/AppenderCollection.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -47,7 +47,7 @@ namespace log4net.Appender /// Advances the enumerator to the next element in the collection. /// </summary> /// <returns> - /// <c>true</c> if the enumerator was successfully advanced to the next element; + /// <c>true</c> if the enumerator was successfully advanced to the next element; /// <c>false</c> if the enumerator has passed the end of the collection. /// </returns> /// <exception cref="InvalidOperationException"> @@ -71,7 +71,7 @@ namespace log4net.Appender private int m_version = 0; #endregion - + #region Static Wrappers /// <summary> @@ -109,7 +109,7 @@ namespace log4net.Appender { m_array = new IAppender[DEFAULT_CAPACITY]; } - + /// <summary> /// Initializes a new instance of the <c>AppenderCollection</c> class /// that has the specified initial capacity. @@ -143,7 +143,7 @@ namespace log4net.Appender m_array = new IAppender[a.Length]; AddRange(a); } - + /// <summary> /// Initializes a new instance of the <c>AppenderCollection</c> class /// that contains elements copied from the specified <see cref="IAppender"/> collection. @@ -160,7 +160,7 @@ namespace log4net.Appender /// Used to access protected constructor /// </summary> /// <exclude/> - internal protected enum Tag + internal protected enum Tag { /// <summary> /// A value @@ -179,7 +179,7 @@ namespace log4net.Appender } #endregion - + #region Operations (type-safe ICollection) /// <summary> @@ -212,8 +212,8 @@ namespace log4net.Appender { throw new System.ArgumentException("Destination array was not long enough."); } - - Array.Copy(m_array, 0, array, start, m_count); + + Array.Copy(m_array, 0, array, start, m_count); } /// <summary> @@ -234,7 +234,7 @@ namespace log4net.Appender } #endregion - + #region Operations (type-safe IList) /// <summary> @@ -251,13 +251,13 @@ namespace log4net.Appender get { ValidateIndex(index); // throws - return m_array[index]; + return m_array[index]; } set { ValidateIndex(index); // throws - ++m_version; - m_array[index] = value; + ++m_version; + m_array[index] = value; } } @@ -278,7 +278,7 @@ namespace log4net.Appender return m_count++; } - + /// <summary> /// Removes all elements from the <c>AppenderCollection</c>. /// </summary> @@ -288,7 +288,7 @@ namespace log4net.Appender m_array = new IAppender[DEFAULT_CAPACITY]; m_count = 0; } - + /// <summary> /// Creates a shallow copy of the <see cref="AppenderCollection"/>. /// </summary> @@ -326,7 +326,7 @@ namespace log4net.Appender /// </summary> /// <param name="item">The <see cref="IAppender"/> to locate in the <c>AppenderCollection</c>.</param> /// <returns> - /// The zero-based index of the first occurrence of <paramref name="item"/> + /// The zero-based index of the first occurrence of <paramref name="item"/> /// in the entire <c>AppenderCollection</c>, if found; otherwise, -1. /// </returns> public virtual int IndexOf(IAppender item) @@ -354,7 +354,7 @@ namespace log4net.Appender public virtual void Insert(int index, IAppender item) { ValidateIndex(index, true); // throws - + if (m_count == m_array.Length) { EnsureCapacity(m_count + 1); @@ -378,13 +378,13 @@ namespace log4net.Appender /// The specified <see cref="IAppender"/> was not found in the <c>AppenderCollection</c>. /// </exception> public virtual void Remove(IAppender item) - { + { int i = IndexOf(item); if (i < 0) { throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection."); } - + ++m_version; RemoveAt(i); } @@ -401,16 +401,16 @@ namespace log4net.Appender public virtual void RemoveAt(int index) { ValidateIndex(index); // throws - + m_count--; if (index < m_count) { Array.Copy(m_array, index + 1, m_array, index, m_count - index); } - + // We can't set the deleted entry equal to null, because it might be a value type. - // Instead, we'll create an empty single-element array of the right type and copy it + // Instead, we'll create an empty single-element array of the right type and copy it // over the entry we want to erase. IAppender[] temp = new IAppender[1]; Array.Copy(temp, 0, m_array, m_count, 1); @@ -438,7 +438,7 @@ namespace log4net.Appender #endregion #region Operations (type-safe IEnumerable) - + /// <summary> /// Returns an enumerator that can iterate through the <c>AppenderCollection</c>. /// </summary> @@ -451,15 +451,15 @@ namespace log4net.Appender #endregion #region Public helpers (just to mimic some nice features of ArrayList) - + /// <summary> /// Gets or sets the number of elements the <c>AppenderCollection</c> can contain. /// </summary> public virtual int Capacity { - get - { - return m_array.Length; + get + { + return m_array.Length; } set { @@ -495,7 +495,7 @@ namespace log4net.Appender { EnsureCapacity(m_count + x.Count); } - + Array.Copy(x.m_array, 0, m_array, m_count, x.Count); m_count += x.Count; m_version++; @@ -521,7 +521,7 @@ namespace log4net.Appender return m_count; } - + /// <summary> /// Adds the elements of a <see cref="IAppender"/> collection to the current <c>AppenderCollection</c>. /// </summary> @@ -604,7 +604,7 @@ namespace log4net.Appender } #endregion - + #region Implementation (ICollection) void ICollection.CopyTo(Array array, int start) @@ -675,15 +675,15 @@ namespace log4net.Appender private sealed class Enumerator : IEnumerator, IAppenderCollectionEnumerator { #region Implementation (data) - + private readonly AppenderCollection m_collection; private int m_index; private int m_version; - + #endregion - + #region Construction - + /// <summary> /// Initializes a new instance of the <c>Enumerator</c> class. /// </summary> @@ -694,11 +694,11 @@ namespace log4net.Appender m_index = -1; m_version = tc.m_version; } - + #endregion - + #region Operations (type-safe IEnumerator) - + /// <summary> /// Gets the current element in the collection. /// </summary> @@ -711,7 +711,7 @@ namespace log4net.Appender /// Advances the enumerator to the next element in the collection. /// </summary> /// <returns> - /// <c>true</c> if the enumerator was successfully advanced to the next element; + /// <c>true</c> if the enumerator was successfully advanced to the next element; /// <c>false</c> if the enumerator has passed the end of the collection. /// </returns> /// <exception cref="InvalidOperationException"> @@ -736,14 +736,14 @@ namespace log4net.Appender m_index = -1; } #endregion - + #region Implementation (IEnumerator) - + object IEnumerator.Current { get { return this.Current; } } - + #endregion } http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/AppenderSkeleton.cs ---------------------------------------------------------------------- diff --git a/src/Appender/AppenderSkeleton.cs b/src/Appender/AppenderSkeleton.cs index 6f99eda..00717e6 100644 --- a/src/Appender/AppenderSkeleton.cs +++ b/src/Appender/AppenderSkeleton.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -29,11 +29,11 @@ using log4net.Core; namespace log4net.Appender { /// <summary> - /// Abstract base class implementation of <see cref="IAppender"/>. + /// Abstract base class implementation of <see cref="IAppender"/>. /// </summary> /// <remarks> /// <para> - /// This class provides the code for common functionality, such + /// This class provides the code for common functionality, such /// as support for threshold filtering and support for general filters. /// </para> /// <para> @@ -64,7 +64,7 @@ namespace log4net.Appender #region Finalizer /// <summary> - /// Finalizes this appender by calling the implementation's + /// Finalizes this appender by calling the implementation's /// <see cref="Close"/> method. /// </summary> /// <remarks> @@ -73,11 +73,11 @@ namespace log4net.Appender /// will call <see cref="Close"/>. /// </para> /// </remarks> - ~AppenderSkeleton() + ~AppenderSkeleton() { - // An appender might be closed then garbage collected. + // An appender might be closed then garbage collected. // There is no point in closing twice. - if (!m_closed) + if (!m_closed) { LogLog.Debug(declaringType, "Finalizing appender named ["+m_name+"]."); Close(); @@ -92,11 +92,11 @@ namespace log4net.Appender /// Gets or sets the threshold <see cref="Level"/> of this appender. /// </summary> /// <value> - /// The threshold <see cref="Level"/> of the appender. + /// The threshold <see cref="Level"/> of the appender. /// </value> /// <remarks> /// <para> - /// All log events with lower level than the threshold level are ignored + /// All log events with lower level than the threshold level are ignored /// by the appender. /// </para> /// <para> @@ -105,7 +105,7 @@ namespace log4net.Appender /// string, such as "DEBUG", "INFO" and so on. /// </para> /// </remarks> - public Level Threshold + public Level Threshold { get { return m_threshold; } set { m_threshold = value; } @@ -117,24 +117,24 @@ namespace log4net.Appender /// <value>The <see cref="IErrorHandler"/> of the appender</value> /// <remarks> /// <para> - /// The <see cref="AppenderSkeleton"/> provides a default - /// implementation for the <see cref="ErrorHandler"/> property. + /// The <see cref="AppenderSkeleton"/> provides a default + /// implementation for the <see cref="ErrorHandler"/> property. /// </para> /// </remarks> - virtual public IErrorHandler ErrorHandler + virtual public IErrorHandler ErrorHandler { get { return this.m_errorHandler; } - set + set { - lock(this) + lock(this) { - if (value == null) + if (value == null) { // We do not throw exception here since the cause is probably a // bad config file. LogLog.Warn(declaringType, "You have tried to set a null error-handler."); - } - else + } + else { m_errorHandler = value; } @@ -167,7 +167,7 @@ namespace log4net.Appender /// </para> /// </remarks> /// <seealso cref="RequiresLayout"/> - virtual public ILayout Layout + virtual public ILayout Layout { get { return m_layout; } set { m_layout = value; } @@ -183,17 +183,17 @@ namespace log4net.Appender /// <remarks> /// <para> /// This is part of the <see cref="IOptionHandler"/> delayed object - /// activation scheme. The <see cref="ActivateOptions"/> method must + /// activation scheme. The <see cref="ActivateOptions"/> method must /// be called on this object after the configuration properties have /// been set. Until <see cref="ActivateOptions"/> is called this - /// object is in an undefined state and must not be used. + /// object is in an undefined state and must not be used. /// </para> /// <para> - /// If any of the configuration properties are modified then + /// If any of the configuration properties are modified then /// <see cref="ActivateOptions"/> must be called again. /// </para> /// </remarks> - virtual public void ActivateOptions() + virtual public void ActivateOptions() { } @@ -210,7 +210,7 @@ namespace log4net.Appender /// The name uniquely identifies the appender. /// </para> /// </remarks> - public string Name + public string Name { get { return m_name; } set { m_name = value; } @@ -221,14 +221,14 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// Release any resources allocated within the appender such as file handles, + /// Release any resources allocated within the appender such as file handles, /// network connections, etc. /// </para> /// <para> /// It is a programming error to append to a closed appender. /// </para> /// <para> - /// This method cannot be overridden by subclasses. This method + /// This method cannot be overridden by subclasses. This method /// delegates the closing of the appender to the <see cref="OnClose"/> /// method which must be overridden in the subclass. /// </para> @@ -247,8 +247,8 @@ namespace log4net.Appender } /// <summary> - /// Performs threshold checks and invokes filters before - /// delegating actual logging to the subclasses specific + /// Performs threshold checks and invokes filters before + /// delegating actual logging to the subclasses specific /// <see cref="M:Append(LoggingEvent)"/> method. /// </summary> /// <param name="loggingEvent">The event to log.</param> @@ -271,13 +271,13 @@ namespace log4net.Appender /// </item> /// <item> /// <description> - /// Checks that the <see cref="IFilter"/> chain accepts the + /// Checks that the <see cref="IFilter"/> chain accepts the /// <paramref name="loggingEvent"/>. /// </description> /// </item> /// <item> /// <description> - /// Calls <see cref="M:PreAppendCheck()"/> and checks that + /// Calls <see cref="M:PreAppendCheck()"/> and checks that /// it returns <c>true</c>.</description> /// </item> /// </list> @@ -287,7 +287,7 @@ namespace log4net.Appender /// will be passed to the abstract <see cref="M:Append(LoggingEvent)"/> method. /// </para> /// </remarks> - public void DoAppend(LoggingEvent loggingEvent) + public void DoAppend(LoggingEvent loggingEvent) { // This lock is absolutely critical for correct formatting // of the message in a multi-threaded environment. Without @@ -322,7 +322,7 @@ namespace log4net.Appender ErrorHandler.Error("Failed in DoAppend", ex); } #if !MONO && !NET_2_0 && !NETSTANDARD1_3 - // on .NET 2.0 (and higher) and Mono (all profiles), + // on .NET 2.0 (and higher) and Mono (all profiles), // exceptions that do not derive from System.Exception will be // wrapped in a RuntimeWrappedException by the runtime, and as // such will be catched by the catch clause above @@ -344,8 +344,8 @@ namespace log4net.Appender #region Implementation of IBulkAppender /// <summary> - /// Performs threshold checks and invokes filters before - /// delegating actual logging to the subclasses specific + /// Performs threshold checks and invokes filters before + /// delegating actual logging to the subclasses specific /// <see cref="M:Append(LoggingEvent[])"/> method. /// </summary> /// <param name="loggingEvents">The array of events to log.</param> @@ -368,13 +368,13 @@ namespace log4net.Appender /// </item> /// <item> /// <description> - /// Checks that the <see cref="IFilter"/> chain accepts the + /// Checks that the <see cref="IFilter"/> chain accepts the /// <paramref name="loggingEvents"/>. /// </description> /// </item> /// <item> /// <description> - /// Calls <see cref="M:PreAppendCheck()"/> and checks that + /// Calls <see cref="M:PreAppendCheck()"/> and checks that /// it returns <c>true</c>.</description> /// </item> /// </list> @@ -384,7 +384,7 @@ namespace log4net.Appender /// will be passed to the <see cref="M:Append(LoggingEvent[])"/> method. /// </para> /// </remarks> - public void DoAppend(LoggingEvent[] loggingEvents) + public void DoAppend(LoggingEvent[] loggingEvents) { // This lock is absolutely critical for correct formatting // of the message in a multi-threaded environment. Without @@ -429,7 +429,7 @@ namespace log4net.Appender ErrorHandler.Error("Failed in Bulk DoAppend", ex); } #if !MONO && !NET_2_0 && !NETSTANDARD1_3 - // on .NET 2.0 (and higher) and Mono (all profiles), + // on .NET 2.0 (and higher) and Mono (all profiles), // exceptions that do not derive from System.Exception will be // wrapped in a RuntimeWrappedException by the runtime, and as // such will be catched by the catch clause above @@ -472,7 +472,7 @@ namespace log4net.Appender /// </item> /// <item> /// <description> - /// Checks that the <see cref="IFilter"/> chain accepts the + /// Checks that the <see cref="IFilter"/> chain accepts the /// <paramref name="loggingEvent"/>. /// </description> /// </item> @@ -481,18 +481,18 @@ namespace log4net.Appender /// </remarks> virtual protected bool FilterEvent(LoggingEvent loggingEvent) { - if (!IsAsSevereAsThreshold(loggingEvent.Level)) + if (!IsAsSevereAsThreshold(loggingEvent.Level)) { return false; } IFilter f = this.FilterHead; - while(f != null) + while(f != null) { - switch(f.Decide(loggingEvent)) + switch(f.Decide(loggingEvent)) { - case FilterDecision.Deny: + case FilterDecision.Deny: return false; // Return without appending case FilterDecision.Accept: @@ -519,7 +519,7 @@ namespace log4net.Appender /// The Filters are organized in a linked list. /// </para> /// <para> - /// Setting this property causes the new filter to be pushed onto the + /// Setting this property causes the new filter to be pushed onto the /// back of the filter chain. /// </para> /// </remarks> @@ -530,14 +530,14 @@ namespace log4net.Appender throw new ArgumentNullException("filter param must not be null"); } - if (m_headFilter == null) + if (m_headFilter == null) { m_headFilter = m_tailFilter = filter; - } - else + } + else { m_tailFilter.Next = filter; - m_tailFilter = filter; + m_tailFilter = filter; } } @@ -568,34 +568,34 @@ namespace log4net.Appender /// </para> /// </remarks> /// <returns> - /// <c>true</c> if the <paramref name="level"/> meets the <see cref="Threshold"/> + /// <c>true</c> if the <paramref name="level"/> meets the <see cref="Threshold"/> /// requirements of this appender. /// </returns> - virtual protected bool IsAsSevereAsThreshold(Level level) + virtual protected bool IsAsSevereAsThreshold(Level level) { return ((m_threshold == null) || level >= m_threshold); } /// <summary> - /// Is called when the appender is closed. Derived classes should override + /// Is called when the appender is closed. Derived classes should override /// this method if resources need to be released. /// </summary> /// <remarks> /// <para> - /// Releases any resources allocated within the appender such as file handles, + /// Releases any resources allocated within the appender such as file handles, /// network connections, etc. /// </para> /// <para> /// It is a programming error to append to a closed appender. /// </para> /// </remarks> - virtual protected void OnClose() + virtual protected void OnClose() { // Do nothing by default } /// <summary> - /// Subclasses of <see cref="AppenderSkeleton"/> should implement this method + /// Subclasses of <see cref="AppenderSkeleton"/> should implement this method /// to perform actual logging. /// </summary> /// <param name="loggingEvent">The event to append.</param> @@ -645,7 +645,7 @@ namespace log4net.Appender /// before the call to the abstract <see cref="M:Append(LoggingEvent)"/> method. /// </para> /// <para> - /// This method can be overridden in a subclass to extend the checks + /// This method can be overridden in a subclass to extend the checks /// made before the event is passed to the <see cref="M:Append(LoggingEvent)"/> method. /// </para> /// <para> @@ -672,13 +672,13 @@ namespace log4net.Appender /// <returns>The event rendered as a string.</returns> /// <remarks> /// <para> - /// Helper method to render a <see cref="LoggingEvent"/> to + /// Helper method to render a <see cref="LoggingEvent"/> to /// a string. This appender must have a <see cref="Layout"/> - /// set to render the <paramref name="loggingEvent"/> to + /// set to render the <paramref name="loggingEvent"/> to /// a string. /// </para> - /// <para>If there is exception data in the logging event and - /// the layout does not process the exception, this method + /// <para>If there is exception data in the logging event and + /// the layout does not process the exception, this method /// will append the exception text to the rendered string. /// </para> /// <para> @@ -714,13 +714,13 @@ namespace log4net.Appender /// <param name="writer">The TextWriter to write the formatted event to</param> /// <remarks> /// <para> - /// Helper method to render a <see cref="LoggingEvent"/> to + /// Helper method to render a <see cref="LoggingEvent"/> to /// a string. This appender must have a <see cref="Layout"/> - /// set to render the <paramref name="loggingEvent"/> to + /// set to render the <paramref name="loggingEvent"/> to /// a string. /// </para> - /// <para>If there is exception data in the logging event and - /// the layout does not process the exception, this method + /// <para>If there is exception data in the logging event and + /// the layout does not process the exception, this method /// will append the exception text to the rendered string. /// </para> /// <para> @@ -732,27 +732,27 @@ namespace log4net.Appender /// </remarks> protected void RenderLoggingEvent(TextWriter writer, LoggingEvent loggingEvent) { - if (m_layout == null) + if (m_layout == null) { throw new InvalidOperationException("A layout must be set"); } - if (m_layout.IgnoresException) + if (m_layout.IgnoresException) { string exceptionStr = loggingEvent.GetExceptionString(); - if (exceptionStr != null && exceptionStr.Length > 0) + if (exceptionStr != null && exceptionStr.Length > 0) { // render the event and the exception m_layout.Format(writer, loggingEvent); writer.WriteLine(exceptionStr); } - else + else { // there is no exception to render m_layout.Format(writer, loggingEvent); } } - else + else { // The layout will render the exception m_layout.Format(writer, loggingEvent); @@ -764,8 +764,8 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// In the rather exceptional case, where the appender - /// implementation admits a layout but can also work without it, + /// In the rather exceptional case, where the appender + /// implementation admits a layout but can also work without it, /// then the appender should return <c>true</c>. /// </para> /// <para> http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/AspNetTraceAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/AspNetTraceAppender.cs b/src/Appender/AspNetTraceAppender.cs index 82f9569..2a9899d 100644 --- a/src/Appender/AspNetTraceAppender.cs +++ b/src/Appender/AspNetTraceAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -26,7 +26,7 @@ using System.Web; using log4net.Layout; using log4net.Core; -namespace log4net.Appender +namespace log4net.Appender { /// <summary> /// <para> @@ -35,25 +35,25 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// Diagnostic information and tracing messages that you specify are appended to the output + /// Diagnostic information and tracing messages that you specify are appended to the output /// of the page that is sent to the requesting browser. Optionally, you can view this information - /// from a separate trace viewer (Trace.axd) that displays trace information for every page in a + /// from a separate trace viewer (Trace.axd) that displays trace information for every page in a /// given application. /// </para> /// <para> - /// Trace statements are processed and displayed only when tracing is enabled. You can control + /// Trace statements are processed and displayed only when tracing is enabled. You can control /// whether tracing is displayed to a page, to the trace viewer, or both. /// </para> /// <para> - /// The logging event is passed to the <see cref="M:TraceContext.Write(string)"/> or + /// The logging event is passed to the <see cref="M:TraceContext.Write(string)"/> or /// <see cref="M:TraceContext.Warn(string)"/> method depending on the level of the logging event. - /// The event's logger name is the default value for the category parameter of the Write/Warn method. + /// The event's logger name is the default value for the category parameter of the Write/Warn method. /// </para> /// </remarks> /// <author>Nicko Cadell</author> /// <author>Gert Driesen</author> /// <author>Ron Grabowski</author> - public class AspNetTraceAppender : AppenderSkeleton + public class AspNetTraceAppender : AppenderSkeleton { #region Public Instances Constructors @@ -65,7 +65,7 @@ namespace log4net.Appender /// Default constructor. /// </para> /// </remarks> - public AspNetTraceAppender() + public AspNetTraceAppender() { } @@ -80,23 +80,23 @@ namespace log4net.Appender /// <remarks> /// <para> /// Write the logging event to the ASP.NET trace - /// <c>HttpContext.Current.Trace</c> + /// <c>HttpContext.Current.Trace</c> /// (<see cref="TraceContext"/>). /// </para> /// </remarks> - override protected void Append(LoggingEvent loggingEvent) + override protected void Append(LoggingEvent loggingEvent) { // check if log4net is running in the context of an ASP.NET application - if (HttpContext.Current != null) + if (HttpContext.Current != null) { // check if tracing is enabled for the current context - if (HttpContext.Current.Trace.IsEnabled) + if (HttpContext.Current.Trace.IsEnabled) { - if (loggingEvent.Level >= Level.Warn) + if (loggingEvent.Level >= Level.Warn) { HttpContext.Current.Trace.Warn(m_category.Format(loggingEvent), RenderLoggingEvent(loggingEvent)); } - else + else { HttpContext.Current.Trace.Write(m_category.Format(loggingEvent), RenderLoggingEvent(loggingEvent)); } @@ -127,11 +127,11 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// Defaults to %logger which will use the logger name of the current + /// Defaults to %logger which will use the logger name of the current /// <see cref="LoggingEvent"/> as the category parameter. /// </para> /// <para> - /// </para> + /// </para> /// </remarks> public PatternLayout Category { http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/BufferingAppenderSkeleton.cs ---------------------------------------------------------------------- diff --git a/src/Appender/BufferingAppenderSkeleton.cs b/src/Appender/BufferingAppenderSkeleton.cs index 343159a..b826b66 100644 --- a/src/Appender/BufferingAppenderSkeleton.cs +++ b/src/Appender/BufferingAppenderSkeleton.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -26,42 +26,42 @@ using log4net.Core; namespace log4net.Appender { /// <summary> - /// Abstract base class implementation of <see cref="IAppender"/> that + /// Abstract base class implementation of <see cref="IAppender"/> that /// buffers events in a fixed size buffer. /// </summary> /// <remarks> /// <para> - /// This base class should be used by appenders that need to buffer a - /// number of events before logging them. For example the <see cref="AdoNetAppender"/> - /// buffers events and then submits the entire contents of the buffer to + /// This base class should be used by appenders that need to buffer a + /// number of events before logging them. For example the <see cref="AdoNetAppender"/> + /// buffers events and then submits the entire contents of the buffer to /// the underlying database in one go. /// </para> /// <para> /// Subclasses should override the <see cref="M:SendBuffer(LoggingEvent[])"/> /// method to deliver the buffered events. /// </para> - /// <para>The BufferingAppenderSkeleton maintains a fixed size cyclic - /// buffer of events. The size of the buffer is set using + /// <para>The BufferingAppenderSkeleton maintains a fixed size cyclic + /// buffer of events. The size of the buffer is set using /// the <see cref="BufferSize"/> property. /// </para> - /// <para>A <see cref="ITriggeringEventEvaluator"/> is used to inspect - /// each event as it arrives in the appender. If the <see cref="Evaluator"/> - /// triggers, then the current buffer is sent immediately - /// (see <see cref="M:SendBuffer(LoggingEvent[])"/>). Otherwise the event - /// is stored in the buffer. For example, an evaluator can be used to + /// <para>A <see cref="ITriggeringEventEvaluator"/> is used to inspect + /// each event as it arrives in the appender. If the <see cref="Evaluator"/> + /// triggers, then the current buffer is sent immediately + /// (see <see cref="M:SendBuffer(LoggingEvent[])"/>). Otherwise the event + /// is stored in the buffer. For example, an evaluator can be used to /// deliver the events immediately when an ERROR event arrives. /// </para> /// <para> - /// The buffering appender can be configured in a <see cref="Lossy"/> mode. - /// By default the appender is NOT lossy. When the buffer is full all + /// The buffering appender can be configured in a <see cref="Lossy"/> mode. + /// By default the appender is NOT lossy. When the buffer is full all /// the buffered events are sent with <see cref="M:SendBuffer(LoggingEvent[])"/>. - /// If the <see cref="Lossy"/> property is set to <c>true</c> then the - /// buffer will not be sent when it is full, and new events arriving - /// in the appender will overwrite the oldest event in the buffer. + /// If the <see cref="Lossy"/> property is set to <c>true</c> then the + /// buffer will not be sent when it is full, and new events arriving + /// in the appender will overwrite the oldest event in the buffer. /// In lossy mode the buffer will only be sent when the <see cref="Evaluator"/> - /// triggers. This can be useful behavior when you need to know about - /// ERROR events but not about events with a lower level, configure an - /// evaluator that will trigger when an ERROR event arrives, the whole + /// triggers. This can be useful behavior when you need to know about + /// ERROR events but not about events with a lower level, configure an + /// evaluator that will trigger when an ERROR event arrives, the whole /// buffer will be sent which gives a history of events leading up to /// the ERROR event. /// </para> @@ -95,7 +95,7 @@ namespace log4net.Appender /// </para> /// <para> /// The <paramref name="eventMustBeFixed"/> should be set if the subclass - /// expects the events delivered to be fixed even if the + /// expects the events delivered to be fixed even if the /// <see cref="BufferSize"/> is set to zero, i.e. when no buffering occurs. /// </para> /// </remarks> @@ -116,11 +116,11 @@ namespace log4net.Appender /// </value> /// <remarks> /// <para> - /// This appender uses a buffer to store logging events before + /// This appender uses a buffer to store logging events before /// delivering them. A triggering event causes the whole buffer /// to be send to the remote sink. If the buffer overruns before /// a triggering event then logging events could be lost. Set - /// <see cref="Lossy"/> to <c>false</c> to prevent logging events + /// <see cref="Lossy"/> to <c>false</c> to prevent logging events /// from being lost. /// </para> /// <para>If <see cref="Lossy"/> is set to <c>true</c> then an @@ -133,7 +133,7 @@ namespace log4net.Appender } /// <summary> - /// Gets or sets the size of the cyclic buffer used to hold the + /// Gets or sets the size of the cyclic buffer used to hold the /// logging events. /// </summary> /// <value> @@ -142,7 +142,7 @@ namespace log4net.Appender /// <remarks> /// <para> /// The <see cref="BufferSize"/> option takes a positive integer - /// representing the maximum number of logging events to collect in + /// representing the maximum number of logging events to collect in /// a cyclic buffer. When the <see cref="BufferSize"/> is reached, /// oldest events are deleted as new events are added to the /// buffer. By default the size of the cyclic buffer is 512 events. @@ -162,7 +162,7 @@ namespace log4net.Appender } /// <summary> - /// Gets or sets the <see cref="ITriggeringEventEvaluator"/> that causes the + /// Gets or sets the <see cref="ITriggeringEventEvaluator"/> that causes the /// buffer to be sent immediately. /// </summary> /// <value> @@ -171,8 +171,8 @@ namespace log4net.Appender /// </value> /// <remarks> /// <para> - /// The evaluator will be called for each event that is appended to this - /// appender. If the evaluator triggers then the current buffer will + /// The evaluator will be called for each event that is appended to this + /// appender. If the evaluator triggers then the current buffer will /// immediately be sent (see <see cref="M:SendBuffer(LoggingEvent[])"/>). /// </para> /// <para>If <see cref="Lossy"/> is set to <c>true</c> then an @@ -192,8 +192,8 @@ namespace log4net.Appender /// </value> /// <remarks> /// <para> - /// The evaluator will be called for each event that is discarded from this - /// appender. If the evaluator triggers then the current buffer will immediately + /// The evaluator will be called for each event that is discarded from this + /// appender. If the evaluator triggers then the current buffer will immediately /// be sent (see <see cref="M:SendBuffer(LoggingEvent[])"/>). /// </para> /// </remarks> @@ -208,7 +208,7 @@ namespace log4net.Appender /// should be fixed. /// </summary> /// <value> - /// <c>true</c> if the appender should only fix part of the logging event + /// <c>true</c> if the appender should only fix part of the logging event /// data, otherwise <c>false</c>. The default is <c>false</c>. /// </value> /// <remarks> @@ -224,8 +224,8 @@ namespace log4net.Appender virtual public bool OnlyFixPartialEventData { get { return (Fix == FixFlags.Partial); } - set - { + set + { if (value) { Fix = FixFlags.Partial; @@ -245,7 +245,7 @@ namespace log4net.Appender /// </value> /// <remarks> /// <para> - /// The logging event needs to have certain thread specific values + /// The logging event needs to have certain thread specific values /// captured before it can be buffered. See <see cref="LoggingEvent.Fix"/> /// for details. /// </para> @@ -301,7 +301,7 @@ namespace log4net.Appender /// <para> /// If the appender is buffering in <see cref="Lossy"/> mode then the contents /// of the buffer will only be flushed if <paramref name="flushLossyBuffer" /> is <c>true</c>. - /// In this case the contents of the buffer will be tested against the + /// In this case the contents of the buffer will be tested against the /// <see cref="LossyEvaluator"/> and if triggering will be output. All other buffered /// events will be discarded. /// </para> @@ -370,17 +370,17 @@ namespace log4net.Appender /// <remarks> /// <para> /// This is part of the <see cref="IOptionHandler"/> delayed object - /// activation scheme. The <see cref="ActivateOptions"/> method must + /// activation scheme. The <see cref="ActivateOptions"/> method must /// be called on this object after the configuration properties have /// been set. Until <see cref="ActivateOptions"/> is called this - /// object is in an undefined state and must not be used. + /// object is in an undefined state and must not be used. /// </para> /// <para> - /// If any of the configuration properties are modified then + /// If any of the configuration properties are modified then /// <see cref="ActivateOptions"/> must be called again. /// </para> /// </remarks> - override public void ActivateOptions() + override public void ActivateOptions() { base.ActivateOptions(); @@ -389,7 +389,7 @@ namespace log4net.Appender // therefore check we have an evaluator. if (m_lossy && m_evaluator == null) { - ErrorHandler.Error("Appender ["+Name+"] is Lossy but has no Evaluator. The buffer will never be sent!"); + ErrorHandler.Error("Appender ["+Name+"] is Lossy but has no Evaluator. The buffer will never be sent!"); } if (m_bufferSize > 1) @@ -412,18 +412,18 @@ namespace log4net.Appender /// <remarks> /// <para> /// Close this appender instance. If this appender is marked - /// as not <see cref="Lossy"/> then the remaining events in + /// as not <see cref="Lossy"/> then the remaining events in /// the buffer must be sent when the appender is closed. /// </para> /// </remarks> - override protected void OnClose() + override protected void OnClose() { // Flush the buffer on close Flush(true); } /// <summary> - /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method. + /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method. /// </summary> /// <param name="loggingEvent">the event to log</param> /// <remarks> @@ -431,7 +431,7 @@ namespace log4net.Appender /// Stores the <paramref name="loggingEvent"/> in the cyclic buffer. /// </para> /// <para> - /// The buffer will be sent (i.e. passed to the <see cref="SendBuffer"/> + /// The buffer will be sent (i.e. passed to the <see cref="SendBuffer"/> /// method) if one of the following conditions is met: /// </para> /// <list type="bullet"> @@ -452,7 +452,7 @@ namespace log4net.Appender /// is processed. /// </para> /// </remarks> - override protected void Append(LoggingEvent loggingEvent) + override protected void Append(LoggingEvent loggingEvent) { // If the buffer size is set to 1 or less then the buffer will be // sent immediately because there is not enough space in the buffer @@ -461,8 +461,8 @@ namespace log4net.Appender if (m_cb == null || m_bufferSize <= 1) { // Only send the event if we are in non lossy mode or the event is a triggering event - if ((!m_lossy) || - (m_evaluator != null && m_evaluator.IsTriggeringEvent(loggingEvent)) || + if ((!m_lossy) || + (m_evaluator != null && m_evaluator.IsTriggeringEvent(loggingEvent)) || (m_lossyEvaluator != null && m_lossyEvaluator.IsTriggeringEvent(loggingEvent))) { if (m_eventMustBeFixed) @@ -610,21 +610,21 @@ namespace log4net.Appender /// </summary> /// <remarks> /// The object that is used to determine if an event causes the entire - /// buffer to be sent immediately. This field can be <c>null</c>, which + /// buffer to be sent immediately. This field can be <c>null</c>, which /// indicates that event triggering is not to be done. The evaluator /// can be set using the <see cref="Evaluator"/> property. If this appender - /// has the <see cref="m_lossy"/> (<see cref="Lossy"/> property) set to + /// has the <see cref="m_lossy"/> (<see cref="Lossy"/> property) set to /// <c>true</c> then an <see cref="Evaluator"/> must be set. /// </remarks> private ITriggeringEventEvaluator m_evaluator; /// <summary> - /// Indicates if the appender should overwrite events in the cyclic buffer - /// when it becomes full, or if the buffer should be flushed when the + /// Indicates if the appender should overwrite events in the cyclic buffer + /// when it becomes full, or if the buffer should be flushed when the /// buffer is full. /// </summary> /// <remarks> - /// If this field is set to <c>true</c> then an <see cref="Evaluator"/> must + /// If this field is set to <c>true</c> then an <see cref="Evaluator"/> must /// be set. /// </remarks> private bool m_lossy = false; @@ -634,9 +634,9 @@ namespace log4net.Appender /// </summary> /// <remarks> /// The object that is used to determine if an event that is discarded should - /// really be discarded or if it should be sent to the appenders. + /// really be discarded or if it should be sent to the appenders. /// This field can be <c>null</c>, which indicates that all discarded events will - /// be discarded. + /// be discarded. /// </remarks> private ITriggeringEventEvaluator m_lossyEvaluator; http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/BufferingForwardingAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/BufferingForwardingAppender.cs b/src/Appender/BufferingForwardingAppender.cs index 17d02b8..e8064b1 100644 --- a/src/Appender/BufferingForwardingAppender.cs +++ b/src/Appender/BufferingForwardingAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -31,12 +31,12 @@ namespace log4net.Appender /// <remarks> /// <para> /// The events are buffered in this appender until conditions are - /// met to allow the appender to deliver the events to the attached + /// met to allow the appender to deliver the events to the attached /// appenders. See <see cref="BufferingAppenderSkeleton"/> for the /// conditions that cause the buffer to be sent. /// </para> - /// <para>The forwarding appender can be used to specify different - /// thresholds and filters for the same appender at different locations + /// <para>The forwarding appender can be used to specify different + /// thresholds and filters for the same appender at different locations /// within the hierarchy. /// </para> /// </remarks> @@ -67,7 +67,7 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// Releases any resources allocated within the appender such as file handles, + /// Releases any resources allocated within the appender such as file handles, /// network connections, etc. /// </para> /// <para> @@ -126,7 +126,7 @@ namespace log4net.Appender /// appenders, then it won't be added again. /// </para> /// </remarks> - virtual public void AddAppender(IAppender newAppender) + virtual public void AddAppender(IAppender newAppender) { if (newAppender == null) { @@ -134,7 +134,7 @@ namespace log4net.Appender } lock(this) { - if (m_appenderAttachedImpl == null) + if (m_appenderAttachedImpl == null) { m_appenderAttachedImpl = new log4net.Util.AppenderAttachedImpl(); } @@ -143,11 +143,11 @@ namespace log4net.Appender } /// <summary> - /// Gets the appenders contained in this appender as an + /// Gets the appenders contained in this appender as an /// <see cref="System.Collections.ICollection"/>. /// </summary> /// <remarks> - /// If no appenders can be found, then an <see cref="EmptyCollection"/> + /// If no appenders can be found, then an <see cref="EmptyCollection"/> /// is returned. /// </remarks> /// <returns> @@ -163,7 +163,7 @@ namespace log4net.Appender { return AppenderCollection.EmptyCollection; } - else + else { return m_appenderAttachedImpl.Appenders; } @@ -183,7 +183,7 @@ namespace log4net.Appender /// Get the named appender attached to this buffering appender. /// </para> /// </remarks> - virtual public IAppender GetAppender(string name) + virtual public IAppender GetAppender(string name) { lock(this) { @@ -204,11 +204,11 @@ namespace log4net.Appender /// This is useful when re-reading configuration information. /// </para> /// </remarks> - virtual public void RemoveAllAppenders() + virtual public void RemoveAllAppenders() { lock(this) { - if (m_appenderAttachedImpl != null) + if (m_appenderAttachedImpl != null) { m_appenderAttachedImpl.RemoveAllAppenders(); m_appenderAttachedImpl = null; @@ -226,11 +226,11 @@ namespace log4net.Appender /// If you are discarding the appender you must call /// <see cref="IAppender.Close"/> on the appender removed. /// </remarks> - virtual public IAppender RemoveAppender(IAppender appender) + virtual public IAppender RemoveAppender(IAppender appender) { lock(this) { - if (appender != null && m_appenderAttachedImpl != null) + if (appender != null && m_appenderAttachedImpl != null) { return m_appenderAttachedImpl.RemoveAppender(appender); } @@ -248,7 +248,7 @@ namespace log4net.Appender /// If you are discarding the appender you must call /// <see cref="IAppender.Close"/> on the appender removed. /// </remarks> - virtual public IAppender RemoveAppender(string name) + virtual public IAppender RemoveAppender(string name) { lock(this) { @@ -259,7 +259,7 @@ namespace log4net.Appender } return null; } - + #endregion Implementation of IAppenderAttachable #region Private Instance Fields http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/ColoredConsoleAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/ColoredConsoleAppender.cs b/src/Appender/ColoredConsoleAppender.cs index 1c26a2c..9d2b9a4 100644 --- a/src/Appender/ColoredConsoleAppender.cs +++ b/src/Appender/ColoredConsoleAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -20,9 +20,9 @@ // MONO 1.0 Beta mcs does not like #if !A && !B && !C syntax // .NET Compact Framework 1.0 has no support for Win32 Console API's -#if !NETCF +#if !NETCF // .Mono 1.0 has no support for Win32 Console API's -#if !MONO +#if !MONO // SSCLI 1.0 has no support for Win32 Console API's #if !SSCLI // We don't want framework or platform specific code in the CLI version of log4net @@ -43,7 +43,7 @@ namespace log4net.Appender /// <remarks> /// <para> /// ColoredConsoleAppender appends log events to the standard output stream - /// or the error output stream using a layout specified by the + /// or the error output stream using a layout specified by the /// user. It also allows the color of a specific type of message to be set. /// </para> /// <para> @@ -158,10 +158,10 @@ namespace log4net.Appender /// Initializes a new instance of the <see cref="ColoredConsoleAppender" /> class. /// </summary> /// <remarks> - /// The instance of the <see cref="ColoredConsoleAppender" /> class is set up to write + /// The instance of the <see cref="ColoredConsoleAppender" /> class is set up to write /// to the standard output stream. /// </remarks> - public ColoredConsoleAppender() + public ColoredConsoleAppender() { } @@ -171,7 +171,7 @@ namespace log4net.Appender /// </summary> /// <param name="layout">the layout to use for this appender</param> /// <remarks> - /// The instance of the <see cref="ColoredConsoleAppender" /> class is set up to write + /// The instance of the <see cref="ColoredConsoleAppender" /> class is set up to write /// to the standard output stream. /// </remarks> [Obsolete("Instead use the default constructor and set the Layout property")] @@ -191,7 +191,7 @@ namespace log4net.Appender /// output stream. /// </remarks> [Obsolete("Instead use the default constructor and set the Layout & Target properties")] - public ColoredConsoleAppender(ILayout layout, bool writeToErrorStream) + public ColoredConsoleAppender(ILayout layout, bool writeToErrorStream) { Layout = layout; m_writeToErrorStream = writeToErrorStream; @@ -221,12 +221,12 @@ namespace log4net.Appender set { string v = value.Trim(); - - if (string.Compare(ConsoleError, v, true, CultureInfo.InvariantCulture) == 0) + + if (string.Compare(ConsoleError, v, true, CultureInfo.InvariantCulture) == 0) { m_writeToErrorStream = true; - } - else + } + else { m_writeToErrorStream = false; } @@ -269,7 +269,7 @@ namespace log4net.Appender [System.Security.SecuritySafeCritical] #endif [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] - override protected void Append(log4net.Core.LoggingEvent loggingEvent) + override protected void Append(log4net.Core.LoggingEvent loggingEvent) { if (m_consoleOutputWriter != null) { @@ -310,13 +310,13 @@ namespace log4net.Appender // Followed by a larger buffer, say 20,000 chars // then WriteConsoleW will fail, last error 8 // 'Not enough storage is available to process this command.' - // + // // Although the documentation states that the buffer must // be less that 64KB (i.e. 32,000 WCHARs) the longest string // that I can write out a the first call to WriteConsoleW // is only 30,704 chars. // - // Unlike the WriteFile API the WriteConsoleW method does not + // Unlike the WriteFile API the WriteConsoleW method does not // seem to be able to partially write out from the input buffer. // It does have a lpNumberOfCharsWritten parameter, but this is // either the length of the input buffer if any output was written, @@ -334,9 +334,9 @@ namespace log4net.Appender // out (UInt32)ignoreWrittenCount, // IntPtr.Zero); // - // Instead of calling WriteConsoleW we use WriteFile which + // Instead of calling WriteConsoleW we use WriteFile which // handles large buffers correctly. Because WriteFile does not - // handle the codepage conversion as WriteConsoleW does we + // handle the codepage conversion as WriteConsoleW does we // need to use a System.IO.StreamWriter with the appropriate // Encoding. The WriteFile calls are wrapped up in the // System.IO.__ConsoleStream internal class obtained through @@ -349,9 +349,9 @@ namespace log4net.Appender // The windows console uses ScrollConsoleScreenBuffer internally to // scroll the console buffer when the display buffer of the console // has been used up. ScrollConsoleScreenBuffer fills the area uncovered - // by moving the current content with the background color + // by moving the current content with the background color // currently specified on the console. This means that it fills the - // whole line in front of the cursor position with the current + // whole line in front of the cursor position with the current // background color. // This causes an issue when writing out text with a non default // background color. For example; We write a message with a Blue @@ -364,7 +364,7 @@ namespace log4net.Appender // Black background). We write some text to the console, the text is // written correctly in White with a Black background, however the // remainder of the line still has a Blue background. - // + // // This causes a disjointed appearance to the output where the background // colors change. // @@ -477,24 +477,24 @@ namespace log4net.Appender #region Public Static Fields /// <summary> - /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console /// standard output stream. /// </summary> /// <remarks> /// <para> - /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console /// standard output stream. /// </para> /// </remarks> public const string ConsoleOut = "Console.Out"; /// <summary> - /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console /// standard error output stream. /// </summary> /// <remarks> /// <para> - /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console /// standard error output stream. /// </para> /// </remarks> @@ -558,29 +558,29 @@ namespace log4net.Appender UInt32 type); [StructLayout(LayoutKind.Sequential)] - private struct COORD + private struct COORD { - public UInt16 x; - public UInt16 y; + public UInt16 x; + public UInt16 y; } [StructLayout(LayoutKind.Sequential)] - private struct SMALL_RECT + private struct SMALL_RECT { - public UInt16 Left; - public UInt16 Top; - public UInt16 Right; - public UInt16 Bottom; + public UInt16 Left; + public UInt16 Top; + public UInt16 Right; + public UInt16 Bottom; } [StructLayout(LayoutKind.Sequential)] - private struct CONSOLE_SCREEN_BUFFER_INFO - { - public COORD dwSize; - public COORD dwCursorPosition; - public ushort wAttributes; - public SMALL_RECT srWindow; - public COORD dwMaximumWindowSize; + private struct CONSOLE_SCREEN_BUFFER_INFO + { + public COORD dwSize; + public COORD dwCursorPosition; + public ushort wAttributes; + public SMALL_RECT srWindow; + public COORD dwMaximumWindowSize; } #endregion // Win32 Methods @@ -647,7 +647,7 @@ namespace log4net.Appender } /// <summary> - /// The combined <see cref="ForeColor"/> and <see cref="BackColor"/> suitable for + /// The combined <see cref="ForeColor"/> and <see cref="BackColor"/> suitable for /// setting the console color. /// </summary> internal ushort CombinedColor http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/ConsoleAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/ConsoleAppender.cs b/src/Appender/ConsoleAppender.cs index d5d6a70..a44337a 100644 --- a/src/Appender/ConsoleAppender.cs +++ b/src/Appender/ConsoleAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -32,7 +32,7 @@ namespace log4net.Appender /// <remarks> /// <para> /// ConsoleAppender appends log events to the standard output stream - /// or the error output stream using a layout specified by the + /// or the error output stream using a layout specified by the /// user. /// </para> /// <para> @@ -41,11 +41,11 @@ namespace log4net.Appender /// error stream. /// </para> /// <para> - /// NOTE: This appender writes each message to the <c>System.Console.Out</c> or + /// NOTE: This appender writes each message to the <c>System.Console.Out</c> or /// <c>System.Console.Error</c> that is set at the time the event is appended. - /// Therefore it is possible to programmatically redirect the output of this appender + /// Therefore it is possible to programmatically redirect the output of this appender /// (for example NUnit does this to capture program output). While this is the desired - /// behavior of this appender it may have security implications in your application. + /// behavior of this appender it may have security implications in your application. /// </para> /// </remarks> /// <author>Nicko Cadell</author> @@ -58,10 +58,10 @@ namespace log4net.Appender /// Initializes a new instance of the <see cref="ConsoleAppender" /> class. /// </summary> /// <remarks> - /// The instance of the <see cref="ConsoleAppender" /> class is set up to write + /// The instance of the <see cref="ConsoleAppender" /> class is set up to write /// to the standard output stream. /// </remarks> - public ConsoleAppender() + public ConsoleAppender() { } @@ -71,7 +71,7 @@ namespace log4net.Appender /// </summary> /// <param name="layout">the layout to use for this appender</param> /// <remarks> - /// The instance of the <see cref="ConsoleAppender" /> class is set up to write + /// The instance of the <see cref="ConsoleAppender" /> class is set up to write /// to the standard output stream. /// </remarks> [Obsolete("Instead use the default constructor and set the Layout property")] @@ -91,7 +91,7 @@ namespace log4net.Appender /// output stream. /// </remarks> [Obsolete("Instead use the default constructor and set the Layout & Target properties")] - public ConsoleAppender(ILayout layout, bool writeToErrorStream) + public ConsoleAppender(ILayout layout, bool writeToErrorStream) { Layout = layout; m_writeToErrorStream = writeToErrorStream; @@ -125,8 +125,8 @@ namespace log4net.Appender if (SystemInfo.EqualsIgnoringCase(ConsoleError, v)) { m_writeToErrorStream = true; - } - else + } + else { m_writeToErrorStream = false; } @@ -149,7 +149,7 @@ namespace log4net.Appender /// The format of the output will depend on the appender's layout. /// </para> /// </remarks> - override protected void Append(LoggingEvent loggingEvent) + override protected void Append(LoggingEvent loggingEvent) { #if NETCF_1_0 // Write to the output stream @@ -187,24 +187,24 @@ namespace log4net.Appender #region Public Static Fields /// <summary> - /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console /// standard output stream. /// </summary> /// <remarks> /// <para> - /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console /// standard output stream. /// </para> /// </remarks> public const string ConsoleOut = "Console.Out"; /// <summary> - /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console /// standard error output stream. /// </summary> /// <remarks> /// <para> - /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console + /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console /// standard error output stream. /// </para> /// </remarks> http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/DebugAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/DebugAppender.cs b/src/Appender/DebugAppender.cs index df6a618..603b725 100644 --- a/src/Appender/DebugAppender.cs +++ b/src/Appender/DebugAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -29,8 +29,8 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// The application configuration file can be used to control what listeners - /// are actually used. See the MSDN documentation for the + /// The application configuration file can be used to control what listeners + /// are actually used. See the MSDN documentation for the /// <see cref="System.Diagnostics.Debug"/> class for details on configuring the /// debug system. /// </para> @@ -57,7 +57,7 @@ namespace log4net.Appender } /// <summary> - /// Initializes a new instance of the <see cref="DebugAppender" /> + /// Initializes a new instance of the <see cref="DebugAppender" /> /// with a specified layout. /// </summary> /// <param name="layout">The layout to use with this appender.</param> @@ -77,16 +77,16 @@ namespace log4net.Appender #region Public Instance Properties /// <summary> - /// Gets or sets a value that indicates whether the appender will + /// Gets or sets a value that indicates whether the appender will /// flush at the end of each write. /// </summary> /// <remarks> - /// <para>The default behavior is to flush at the end of each - /// write. If the option is set to<c>false</c>, then the underlying - /// stream can defer writing to physical medium to a later time. + /// <para>The default behavior is to flush at the end of each + /// write. If the option is set to<c>false</c>, then the underlying + /// stream can defer writing to physical medium to a later time. /// </para> /// <para> - /// Avoiding the flush operation at the end of each append results + /// Avoiding the flush operation at the end of each append results /// in a performance gain of 10 to 20 percent. However, there is safety /// trade-off involved in skipping flushing. Indeed, when flushing is /// skipped, then it is likely that the last few log events will not @@ -105,18 +105,18 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// Defaults to a <see cref="Layout.PatternLayout"/> with %logger as the pattern which will use the logger name of the current + /// Defaults to a <see cref="Layout.PatternLayout"/> with %logger as the pattern which will use the logger name of the current /// <see cref="LoggingEvent"/> as the category parameter. /// </para> /// <para> - /// </para> + /// </para> /// </remarks> public PatternLayout Category { get { return m_category; } set { m_category = value; } } - + #endregion Public Instance Properties #if !NETSTANDARD1_3 @@ -150,7 +150,7 @@ namespace log4net.Appender /// is called. /// </para> /// </remarks> - override protected void Append(LoggingEvent loggingEvent) + override protected void Append(LoggingEvent loggingEvent) { // // Write the string to the Debug system @@ -175,10 +175,10 @@ namespace log4net.Appender // // Flush the Debug system if needed // - if (m_immediateFlush) + if (m_immediateFlush) { System.Diagnostics.Debug.Flush(); - } + } #endif } @@ -206,7 +206,7 @@ namespace log4net.Appender /// </summary> /// <remarks> /// <para> - /// Immediate flush is slower but ensures that each append request is + /// Immediate flush is slower but ensures that each append request is /// actually written. If <see cref="ImmediateFlush"/> is set to /// <c>false</c>, then there is a good chance that the last few /// logs events are not actually written to persistent media if and http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/8a5b4204/src/Appender/EventLogAppender.cs ---------------------------------------------------------------------- diff --git a/src/Appender/EventLogAppender.cs b/src/Appender/EventLogAppender.cs index 9cc031e..8cf183a 100644 --- a/src/Appender/EventLogAppender.cs +++ b/src/Appender/EventLogAppender.cs @@ -1,10 +1,10 @@ #region Apache License // -// Licensed to the Apache Software Foundation (ASF) under one or more +// Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. +// this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with +// (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 @@ -20,7 +20,7 @@ // MONO 1.0 Beta mcs does not like #if !A && !B && !C syntax // .NET Compact Framework 1.0 has no support for EventLog -#if !NETCF +#if !NETCF // SSCLI 1.0 has no support for EventLog #if !SSCLI @@ -137,7 +137,7 @@ namespace log4net.Appender /// then you should set the <see cref="LogName"/> appropriately.</para> /// <para>This should not be used to distinguish your event log messages /// from those of other applications, the <see cref="ApplicationName"/> - /// property should be used to distinguish events. This property should be + /// property should be used to distinguish events. This property should be /// used to group together events into a single log. /// </para> /// </remarks> @@ -169,7 +169,7 @@ namespace log4net.Appender /// computer, denoted by a dot "." /// </summary> /// <value> - /// The string name of the machine holding the event log that + /// The string name of the machine holding the event log that /// will be logged into. /// </value> /// <remarks> @@ -214,7 +214,7 @@ namespace log4net.Appender /// of the current thread. /// </para> /// </remarks> - public SecurityContext SecurityContext + public SecurityContext SecurityContext { get { return m_securityContext; } set { m_securityContext = value; } @@ -263,17 +263,17 @@ namespace log4net.Appender /// <remarks> /// <para> /// This is part of the <see cref="IOptionHandler"/> delayed object - /// activation scheme. The <see cref="ActivateOptions"/> method must + /// activation scheme. The <see cref="ActivateOptions"/> method must /// be called on this object after the configuration properties have /// been set. Until <see cref="ActivateOptions"/> is called this - /// object is in an undefined state and must not be used. + /// object is in an undefined state and must not be used. /// </para> /// <para> - /// If any of the configuration properties are modified then + /// If any of the configuration properties are modified then /// <see cref="ActivateOptions"/> must be called again. /// </para> /// </remarks> - override public void ActivateOptions() + override public void ActivateOptions() { try { @@ -360,26 +360,26 @@ namespace log4net.Appender EventLog.CreateEventSource(source, logName, machineName); #endif } - + #region Override implementation of AppenderSkeleton /// <summary> /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> - /// method. + /// method. /// </summary> /// <param name="loggingEvent">the event to log</param> /// <remarks> - /// <para>Writes the event to the system event log using the + /// <para>Writes the event to the system event log using the /// <see cref="ApplicationName"/>.</para> - /// + /// /// <para>If the event has an <c>EventID</c> property (see <see cref="LoggingEvent.Properties"/>) /// set then this integer will be used as the event log event id.</para> - /// + /// /// <para> /// There is a limit of 32K characters for an event log message /// </para> /// </remarks> - override protected void Append(LoggingEvent loggingEvent) + override protected void Append(LoggingEvent loggingEvent) { // // Write the resulting string to the event log system @@ -471,7 +471,7 @@ namespace log4net.Appender { ErrorHandler.Error("Unable to write to event log [" + m_logName + "] using source [" + m_applicationName + "]", ex); } - } + } /// <summary> /// This appender requires a <see cref="Layout"/> to be set. @@ -498,7 +498,7 @@ namespace log4net.Appender /// <returns>The equivalent <see cref="EventLogEntryType"/> for a <see cref="Level"/> <paramref name="level"/></returns> /// <remarks> /// Because there are fewer applicable <see cref="EventLogEntryType"/> - /// values to use in logging levels than there are in the + /// values to use in logging levels than there are in the /// <see cref="Level"/> this is a one way mapping. There is /// a loss of information during the conversion. /// </remarks> @@ -513,14 +513,14 @@ namespace log4net.Appender // Use default behavior - if (level >= Level.Error) + if (level >= Level.Error) { return EventLogEntryType.Error; } - else if (level == Level.Warn) + else if (level == Level.Warn) { return EventLogEntryType.Warning; - } + } // Default setting return EventLogEntryType.Information; @@ -619,11 +619,11 @@ namespace log4net.Appender /// </summary> /// <remarks> /// http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx - /// The 32766 documented max size is two bytes shy of 32K (I'm assuming 32766 - /// may leave space for a two byte null terminator of #0#0). The 32766 max - /// length is what the .NET 4.0 source code checks for, but this is WRONG! - /// Strings with a length > 31839 on Windows Vista or higher can CORRUPT - /// the event log! See: System.Diagnostics.EventLogInternal.InternalWriteEvent() + /// The 32766 documented max size is two bytes shy of 32K (I'm assuming 32766 + /// may leave space for a two byte null terminator of #0#0). The 32766 max + /// length is what the .NET 4.0 source code checks for, but this is WRONG! + /// Strings with a length > 31839 on Windows Vista or higher can CORRUPT + /// the event log! See: System.Diagnostics.EventLogInternal.InternalWriteEvent() /// for the use of the 32766 max size. /// </remarks> private readonly static int MAX_EVENTLOG_MESSAGE_SIZE_DEFAULT = 32766; @@ -636,22 +636,22 @@ namespace log4net.Appender /// See ReportEvent API: /// http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx /// ReportEvent's lpStrings parameter: - /// "A pointer to a buffer containing an array of - /// null-terminated strings that are merged into the message before Event Viewer - /// displays the string to the user. This parameter must be a valid pointer + /// "A pointer to a buffer containing an array of + /// null-terminated strings that are merged into the message before Event Viewer + /// displays the string to the user. This parameter must be a valid pointer /// (or NULL), even if wNumStrings is zero. Each string is limited to 31,839 characters." - /// + /// /// Going beyond the size of 31839 will (at some point) corrupt the event log on Windows /// Vista or higher! It may succeed for a while...but you will eventually run into the /// error: "System.ComponentModel.Win32Exception : A device attached to the system is - /// not functioning", and the event log will then be corrupt (I was able to corrupt + /// not functioning", and the event log will then be corrupt (I was able to corrupt /// an event log using a length of 31877 on Windows 7). - /// + /// /// The max size for Windows Vista or higher is documented here: /// http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx. - /// Going over this size may succeed a few times but the buffer will overrun and + /// Going over this size may succeed a few times but the buffer will overrun and /// eventually corrupt the log (based on testing). - /// + /// /// The maxEventMsgSize size is based on the max buffer size of the lpStrings parameter of the ReportEvent API. /// The documented max size for EventLog.WriteEntry for Windows Vista and higher is 31839, but I'm leaving room for a /// terminator of #0#0, as we cannot see the source of ReportEvent (though we could use an API monitor to examine the