亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? textwriterappender.cs

?? 詳細(xì)講述了數(shù)據(jù)庫(kù)編程
?? CS
字號(hào):
#region Copyright & License
//
// Copyright 2001-2005 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

using System;
using System.IO;

using log4net.Util;
using log4net.Layout;
using log4net.Core;

namespace log4net.Appender
{
	/// <summary>
	/// Sends logging events to a <see cref="TextWriter"/>.
	/// </summary>
	/// <remarks>
	/// <para>
	/// An Appender that writes to a <see cref="TextWriter"/>.
	/// </para>
	/// <para>
	/// This appender may be used stand alone if initialized with an appropriate
	/// writer, however it is typically used as a base class for an appender that
	/// can open a <see cref="TextWriter"/> to write to.
	/// </para>
	/// </remarks>
	/// <author>Nicko Cadell</author>
	/// <author>Gert Driesen</author>
	/// <author>Douglas de la Torre</author>
	public class TextWriterAppender : AppenderSkeleton
	{
		#region Public Instance Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="TextWriterAppender" /> class.
		/// </summary>
		/// <remarks>
		/// <para>
		/// Default constructor.
		/// </para>
		/// </remarks>
		public TextWriterAppender() 
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="TextWriterAppender" /> class and
		/// sets the output destination to a new <see cref="StreamWriter"/> initialized 
		/// with the specified <see cref="Stream"/>.
		/// </summary>
		/// <param name="layout">The layout to use with this appender.</param>
		/// <param name="os">The <see cref="Stream"/> to output to.</param>
		/// <remarks>
		/// <para>
		/// Obsolete constructor.
		/// </para>
		/// </remarks>
		[Obsolete("Instead use the default constructor and set the Layout & Writer properties")]
		public TextWriterAppender(ILayout layout, Stream os) : this(layout, new StreamWriter(os))
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="TextWriterAppender" /> class and sets
		/// the output destination to the specified <see cref="StreamWriter" />.
		/// </summary>
		/// <param name="layout">The layout to use with this appender</param>
		/// <param name="writer">The <see cref="TextWriter" /> to output to</param>
		/// <remarks>
		/// The <see cref="TextWriter" /> must have been previously opened.
		/// </remarks>
		/// <remarks>
		/// <para>
		/// Obsolete constructor.
		/// </para>
		/// </remarks>
		[Obsolete("Instead use the default constructor and set the Layout & Writer properties")]
		public TextWriterAppender(ILayout layout, TextWriter writer) 
		{
			Layout = layout;
			Writer = writer;
		}

		#endregion

		#region Public Instance Properties

		/// <summary>
		/// Gets or set whether the appender will flush at the end 
		/// of each append operation.
		/// </summary>
		/// <value>
		/// <para>
		/// The default behavior is to flush at the end of each 
		/// append operation.
		/// </para>
		/// <para>
		/// If this option is set to <c>false</c>, then the underlying 
		/// stream can defer persisting the logging event to a later 
		/// time.
		/// </para>
		/// </value>
		/// <remarks>
		/// 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
		/// be recorded on disk when the application exits. This is a high
		/// price to pay even for a 20% performance gain.
		/// </remarks>
		public bool ImmediateFlush 
		{
			get { return m_immediateFlush; }
			set { m_immediateFlush = value; }
		}

		/// <summary>
		/// Sets the <see cref="TextWriter"/> where the log output will go.
		/// </summary>
		/// <remarks>
		/// <para>
		/// The specified <see cref="TextWriter"/> must be open and writable.
		/// </para>
		/// <para>
		/// The <see cref="TextWriter"/> will be closed when the appender 
		/// instance is closed.
		/// </para>
		/// <para>
		/// <b>Note:</b> Logging to an unopened <see cref="TextWriter"/> will fail.
		/// </para>
		/// </remarks>
		virtual public TextWriter Writer 
		{
			get { return m_qtw; }
			set 
			{
				lock(this) 
				{
					Reset();
					if (value != null)
					{
						m_qtw = new QuietTextWriter(value, ErrorHandler);
						WriteHeader();
					}
				}
			}
		}

		#endregion Public Instance Properties

		#region Override implementation of AppenderSkeleton

		/// <summary>
		/// This method determines if there is a sense in attempting to append.
		/// </summary>
		/// <remarks>
		/// <para>
		/// This method checked if an output target has been set and if a
		/// layout has been set. 
		/// </para>
		/// </remarks>
		/// <returns><c>false</c> if any of the preconditions fail.</returns>
		override protected bool PreAppendCheck() 
		{
			if (!base.PreAppendCheck()) 
			{
				return false;
			}

			if (m_qtw == null) 
			{
				// Allow subclass to lazily create the writer
				PrepareWriter();

				if (m_qtw == null) 
				{
					ErrorHandler.Error("No output stream or file set for the appender named ["+ Name +"].");
					return false;
				}
			}
			if (m_qtw.Closed) 
			{
				ErrorHandler.Error("Output stream for appender named ["+ Name +"] has been closed.");
				return false;
			}

			return true;
		}

		/// <summary>
		/// This method is called by the <see cref="AppenderSkeleton.DoAppend(LoggingEvent)"/>
		/// method. 
		/// </summary>
		/// <param name="loggingEvent">The event to log.</param>
		/// <remarks>
		/// <para>
		/// Writes a log statement to the output stream if the output stream exists 
		/// and is writable.  
		/// </para>
		/// <para>
		/// The format of the output will depend on the appender's layout.
		/// </para>
		/// </remarks>
		override protected void Append(LoggingEvent loggingEvent) 
		{
			RenderLoggingEvent(m_qtw, loggingEvent);

			if (m_immediateFlush) 
			{
				m_qtw.Flush();
			} 
		}

		/// <summary>
		/// This method is called by the <see cref="AppenderSkeleton.DoAppend(LoggingEvent[])"/>
		/// method. 
		/// </summary>
		/// <param name="loggingEvents">The array of events to log.</param>
		/// <remarks>
		/// <para>
		/// This method writes all the bulk logged events to the output writer
		/// before flushing the stream.
		/// </para>
		/// </remarks>
		override protected void Append(LoggingEvent[] loggingEvents) 
		{
			foreach(LoggingEvent loggingEvent in loggingEvents)
			{
				RenderLoggingEvent(m_qtw, loggingEvent);
			}

			if (m_immediateFlush) 
			{
				m_qtw.Flush();
			} 
		}

		/// <summary>
		/// Close this appender instance. The underlying stream or writer is also closed.
		/// </summary>
		/// <remarks>
		/// Closed appenders cannot be reused.
		/// </remarks>
		override protected void OnClose() 
		{
			lock(this)
			{
				Reset();
			}
		}

		/// <summary>
		/// Gets or set the <see cref="IErrorHandler"/> and the underlying 
		/// <see cref="QuietTextWriter"/>, if any, for this appender. 
		/// </summary>
		/// <value>
		/// The <see cref="IErrorHandler"/> for this appender.
		/// </value>
		override public IErrorHandler ErrorHandler
		{
			get { return base.ErrorHandler; }
			set
			{
				lock(this)
				{
					if (value == null) 
					{
						LogLog.Warn("TextWriterAppender: You have tried to set a null error-handler.");
					} 
					else 
					{
						base.ErrorHandler = value;
						if (m_qtw != null) 
						{
							m_qtw.ErrorHandler = value;
						}
					}	
				}
			}
		}

		/// <summary>
		/// This appender requires a <see cref="Layout"/> to be set.
		/// </summary>
		/// <value><c>true</c></value>
		/// <remarks>
		/// <para>
		/// This appender requires a <see cref="Layout"/> to be set.
		/// </para>
		/// </remarks>
		override protected bool RequiresLayout
		{
			get { return true; }
		}

		#endregion Override implementation of AppenderSkeleton

		#region Protected Instance Methods

		/// <summary>
		/// Writes the footer and closes the underlying <see cref="TextWriter"/>.
		/// </summary>
		/// <remarks>
		/// <para>
		/// Writes the footer and closes the underlying <see cref="TextWriter"/>.
		/// </para>
		/// </remarks>
		virtual protected void WriteFooterAndCloseWriter()
		{
			WriteFooter();
			CloseWriter();
		}

		/// <summary>
		/// Closes the underlying <see cref="TextWriter"/>.
		/// </summary>
		/// <remarks>
		/// <para>
		/// Closes the underlying <see cref="TextWriter"/>.
		/// </para>
		/// </remarks>
		virtual protected void CloseWriter() 
		{
			if (m_qtw != null) 
			{
				try 
				{
					m_qtw.Close();
				} 
				catch(Exception e) 
				{
					ErrorHandler.Error("Could not close writer ["+m_qtw+"]", e); 
					// do need to invoke an error handler
					// at this late stage
				}
			}
		}

		/// <summary>
		/// Clears internal references to the underlying <see cref="TextWriter" /> 
		/// and other variables.
		/// </summary>
		/// <remarks>
		/// <para>
		/// Subclasses can override this method for an alternate closing behavior.
		/// </para>
		/// </remarks>
		virtual protected void Reset() 
		{
			WriteFooterAndCloseWriter();
			m_qtw = null;
		}

		/// <summary>
		/// Writes a footer as produced by the embedded layout's <see cref="ILayout.Footer"/> property.
		/// </summary>
		/// <remarks>
		/// <para>
		/// Writes a footer as produced by the embedded layout's <see cref="ILayout.Footer"/> property.
		/// </para>
		/// </remarks>
		virtual protected void WriteFooter() 
		{
			if (Layout != null && m_qtw != null && !m_qtw.Closed) 
			{
				string f = Layout.Footer;
				if (f != null)
				{
					m_qtw.Write(f);
				}
			}
		}

		/// <summary>
		/// Writes a header produced by the embedded layout's <see cref="ILayout.Header"/> property.
		/// </summary>
		/// <remarks>
		/// <para>
		/// Writes a header produced by the embedded layout's <see cref="ILayout.Header"/> property.
		/// </para>
		/// </remarks>
		virtual protected void WriteHeader() 
		{
			if (Layout != null && m_qtw != null && !m_qtw.Closed) 
			{
				string h = Layout.Header;
				if (h != null)
				{
					m_qtw.Write(h);
				}
			}
		}

		/// <summary>
		/// Called to allow a subclass to lazily initialize the writer
		/// </summary>
		/// <remarks>
		/// <para>
		/// This method is called when an event is logged and the <see cref="Writer"/> or
		/// <see cref="QuietWriter"/> have not been set. This allows a subclass to
		/// attempt to initialize the writer multiple times.
		/// </para>
		/// </remarks>
		virtual protected void PrepareWriter()
		{
		}

		#endregion Protected Instance Methods

		/// <summary>
		/// Gets or sets the <see cref="log4net.Util.QuietTextWriter"/> where logging events
		/// will be written to. 
		/// </summary>
		/// <value>
		/// The <see cref="log4net.Util.QuietTextWriter"/> where logging events are written.
		/// </value>
		/// <remarks>
		/// <para>
		/// This is the <see cref="log4net.Util.QuietTextWriter"/> where logging events
		/// will be written to. 
		/// </para>
		/// </remarks>
		protected QuietTextWriter QuietWriter
		{
			get { return m_qtw; }
			set { m_qtw = value; }
		}

		#region Private Instance Fields

		/// <summary>
		/// This is the <see cref="log4net.Util.QuietTextWriter"/> where logging events
		/// will be written to. 
		/// </summary>
		private QuietTextWriter m_qtw;

		/// <summary>
		/// Immediate flush means that the underlying <see cref="TextWriter" /> 
		/// or output stream will be flushed at the end of each append operation.
		/// </summary>
		/// <remarks>
		/// <para>
		/// 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
		/// logging events are not actually persisted if and when the application 
		/// crashes.
		/// </para>
		/// <para>
		/// The default value is <c>true</c>.
		/// </para>
		/// </remarks>
		private bool m_immediateFlush = true;

		#endregion Private Instance Fields
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产性色一区二区| 91精品国产综合久久香蕉的特点 | 亚洲欧洲国产专区| 91麻豆精东视频| 午夜精品在线看| 亚洲国产精品激情在线观看| 欧美精品v日韩精品v韩国精品v| 亚洲同性同志一二三专区| 日韩一区二区三| 91原创在线视频| 黑人巨大精品欧美黑白配亚洲| 欧美一区二区日韩一区二区| 91在线视频网址| 国内精品视频666| 天天综合色天天| 中文字幕色av一区二区三区| 精品成人免费观看| 欧美少妇bbb| 99久久国产综合精品色伊| 韩国欧美一区二区| 日韩国产在线观看| 一区二区三区四区激情| 国产精品成人在线观看| 久久人人爽爽爽人久久久| 91精品国产全国免费观看| 91视频91自| 成人中文字幕在线| 国产麻豆成人传媒免费观看| 日本不卡的三区四区五区| 一区二区三区鲁丝不卡| 亚洲视频在线观看一区| 中文乱码免费一区二区| 久久精品夜色噜噜亚洲aⅴ| 日韩一级片网站| 91精品国产色综合久久| 欧美丰满美乳xxx高潮www| 欧美性受xxxx| 91国产免费观看| 日本高清免费不卡视频| 91麻豆.com| 91九色最新地址| 在线看一区二区| 色婷婷国产精品| 色噜噜久久综合| 91极品美女在线| 欧美中文字幕一二三区视频| 91国偷自产一区二区三区观看 | 亚洲一区二区三区四区不卡| 成人免费视频在线观看| 最新国产成人在线观看| 亚洲欧美国产77777| 亚洲视频在线一区观看| 亚洲美女屁股眼交| 一区二区三区免费| 午夜激情综合网| 人妖欧美一区二区| 精品一区二区在线免费观看| 国精品**一区二区三区在线蜜桃| 日韩毛片高清在线播放| 亚洲乱码国产乱码精品精的特点| 日韩一区二区免费视频| 91精品国产综合久久福利| 日韩欧美一区在线| 久久久不卡网国产精品一区| 欧美激情综合五月色丁香小说| 欧美日韩午夜在线视频| 欧美一卡二卡在线| 精品欧美乱码久久久久久1区2区| 一本在线高清不卡dvd| 一本大道久久a久久精品综合 | 91丨九色丨蝌蚪丨老版| 欧美在线制服丝袜| 欧美一级免费观看| 久久久精品国产免费观看同学| 欧美福利视频一区| 精品国产一区二区三区不卡 | 国产精品你懂的在线| 亚洲精品日韩一| 日韩电影一二三区| 国产黄人亚洲片| 91久久精品网| 精品欧美一区二区久久| 国产精品青草综合久久久久99| 精品国产免费一区二区三区四区 | 2024国产精品| 亚洲视频每日更新| 视频一区欧美精品| 国产不卡在线播放| 欧美三级视频在线观看| 久久蜜桃香蕉精品一区二区三区| 正在播放一区二区| 国产精品网站在线观看| 午夜一区二区三区视频| 国产成人午夜视频| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 激情亚洲综合在线| 91免费小视频| 欧美精品一区二区三区高清aⅴ| 欧美二区三区的天堂| 中文字幕精品在线不卡| 午夜不卡在线视频| 成人av免费网站| 欧美一级高清大全免费观看| 亚洲欧美日韩小说| 国产一区在线观看麻豆| 欧美日韩在线精品一区二区三区激情| 99久久国产免费看| 精品电影一区二区| 日韩成人精品视频| 日本黄色一区二区| 欧美精品一区二区久久婷婷| 午夜免费欧美电影| 色婷婷av一区二区三区软件| 国产日韩视频一区二区三区| 日本特黄久久久高潮| 91搞黄在线观看| 综合色天天鬼久久鬼色| 国产风韵犹存在线视精品| 91麻豆精品国产| 亚洲不卡在线观看| 色婷婷av一区二区三区软件| 国产精品人成在线观看免费 | 日韩和欧美一区二区三区| 国产91精品露脸国语对白| 色女孩综合影院| 欧美大片一区二区| 亚洲国产一二三| 成人av资源网站| 精品国产不卡一区二区三区| 亚洲va天堂va国产va久| 在线视频你懂得一区二区三区| 91电影在线观看| 中文字幕欧美激情一区| 日韩av一区二区在线影视| 欧美在线你懂得| 一区二区成人在线视频| 波多野结衣欧美| 国产亚洲欧美日韩日本| 麻豆国产欧美一区二区三区| 欧美日韩三级在线| 天天综合色天天综合色h| 欧美专区亚洲专区| 一区二区在线观看视频| 成人午夜电影网站| 日韩三级视频在线看| 日本午夜一区二区| 91精品久久久久久久91蜜桃| 午夜精品爽啪视频| 欧美丝袜自拍制服另类| 天天av天天翘天天综合网色鬼国产 | 久久精品理论片| 欧美一二三四区在线| 日韩av在线发布| 欧美videos大乳护士334| 免费观看成人鲁鲁鲁鲁鲁视频| 国内久久精品视频| 91精品国产综合久久久久久漫画 | 日本精品一区二区三区高清| 日韩理论在线观看| 懂色av一区二区夜夜嗨| 久久精品一区二区三区不卡牛牛 | 国产精品人妖ts系列视频 | 另类欧美日韩国产在线| 3d动漫精品啪啪1区2区免费| 婷婷综合另类小说色区| 欧美精品日韩综合在线| 亚洲一区二区三区四区五区中文 | 色吊一区二区三区| 一级精品视频在线观看宜春院| 麻豆一区二区三| 精品福利视频一区二区三区| 国产高清不卡二三区| 中文幕一区二区三区久久蜜桃| 蜜桃一区二区三区在线| 日韩视频在线观看一区二区| 精品在线免费视频| 欧美激情在线一区二区| gogogo免费视频观看亚洲一| 国产精品久久久久婷婷二区次| 一区二区三区毛片| 日韩一本二本av| 国产美女精品一区二区三区| 国产精品美女久久久久久| 成人免费av在线| 日韩精品每日更新| 久久久亚洲精品石原莉奈| 成人免费视频国产在线观看| 亚洲另类春色校园小说| 成人av在线看| 日本欧美大码aⅴ在线播放| 日韩精品一区二区在线| 丰满亚洲少妇av| 一级精品视频在线观看宜春院| 毛片av一区二区| 一区二区三区中文字幕| 欧美一区欧美二区| 国产成人精品综合在线观看| 夜夜亚洲天天久久| 日韩欧美你懂的| 欧美日韩在线综合|